r19336 - in /branches/upstream/librelative-perl: ./ current/ current/eg/ current/lib/ current/t/ current/t/BigApp/ current/t/BigApp/Report/ current/t/Enterprise/ current/t/Enterprise/Framework/
efaistos-guest at users.alioth.debian.org
efaistos-guest at users.alioth.debian.org
Fri May 2 14:42:28 UTC 2008
Author: efaistos-guest
Date: Fri May 2 14:42:27 2008
New Revision: 19336
URL: http://svn.debian.org/wsvn/?sc=1&rev=19336
Log:
[svn-inject] Installing original source of librelative-perl
Added:
branches/upstream/librelative-perl/
branches/upstream/librelative-perl/current/
branches/upstream/librelative-perl/current/Build.PL
branches/upstream/librelative-perl/current/Changes
branches/upstream/librelative-perl/current/MANIFEST
branches/upstream/librelative-perl/current/META.yml
branches/upstream/librelative-perl/current/Makefile.PL
branches/upstream/librelative-perl/current/README
branches/upstream/librelative-perl/current/eg/
branches/upstream/librelative-perl/current/eg/README
branches/upstream/librelative-perl/current/lib/
branches/upstream/librelative-perl/current/lib/relative.pm
branches/upstream/librelative-perl/current/t/
branches/upstream/librelative-perl/current/t/00-load.t
branches/upstream/librelative-perl/current/t/BigApp/
branches/upstream/librelative-perl/current/t/BigApp/Report/
branches/upstream/librelative-perl/current/t/BigApp/Report.pm
branches/upstream/librelative-perl/current/t/BigApp/Report/Create.pm
branches/upstream/librelative-perl/current/t/BigApp/Report/Publish.pm
branches/upstream/librelative-perl/current/t/BigApp/Tools.pm
branches/upstream/librelative-perl/current/t/BigApp/Utils.pm
branches/upstream/librelative-perl/current/t/Enterprise/
branches/upstream/librelative-perl/current/t/Enterprise/Framework/
branches/upstream/librelative-perl/current/t/Enterprise/Framework/Base.pm
branches/upstream/librelative-perl/current/t/Enterprise/Framework/Factory.pm
branches/upstream/librelative-perl/current/t/pod-coverage.t
branches/upstream/librelative-perl/current/t/pod.t
branches/upstream/librelative-perl/current/t/relative-aliased.t
branches/upstream/librelative-perl/current/t/relative-args.t
branches/upstream/librelative-perl/current/t/relative-fail.t
branches/upstream/librelative-perl/current/t/relative-plain.t
Added: branches/upstream/librelative-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/branches/upstream/librelative-perl/current/Build.PL?rev=19336&op=file
==============================================================================
--- branches/upstream/librelative-perl/current/Build.PL (added)
+++ branches/upstream/librelative-perl/current/Build.PL Fri May 2 14:42:27 2008
@@ -1,0 +1,18 @@
+use strict;
+use Module::Build;
+
+my $builder = Module::Build->new(
+ module_name => 'relative',
+ license => 'perl',
+ dist_author => 'Sebastien Aperghis-Tramoni <sebastien at aperghis.net>',
+ dist_version_from => 'lib/relative.pm',
+ requires => {
+ 'UNIVERSAL::require' => 0,
+ },
+ build_requires => {
+ 'Test::More' => 0,
+ },
+ add_to_cleanup => [ 'relative-*' ],
+);
+
+$builder->create_build_script();
Added: branches/upstream/librelative-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/librelative-perl/current/Changes?rev=19336&op=file
==============================================================================
--- branches/upstream/librelative-perl/current/Changes (added)
+++ branches/upstream/librelative-perl/current/Changes Fri May 2 14:42:27 2008
@@ -1,0 +1,20 @@
+Revision history for relative
+
+0.04 2008.02.01 (SAPER)
+ [BUGFIX] Really make the errors appear as coming from the caller.
+
+0.03 2007.10.26 (SAPER)
+ [BUGFIX] Fixed a bug in the regexp that resolve parent names.
+ [FEATURE] New short-hand syntax for sibling modules.
+ [FEATURE] Implement alias support (Curtis Poe).
+ [CODE] Check the eval(import) as well (Eric Wilhelm).
+
+0.02 2007.10.07 (SAPER)
+ [FEATURE] import() now returns the list of loaded modules (thanks
+ to Ken Williams).
+ [API] Changed to short form from "to => ..." to "-to => ..." in
+ order to avoid module name clash.
+
+0.01 2007.10.06 (SAPER)
+ First version, released on an unsuspecting world.
+
Added: branches/upstream/librelative-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/librelative-perl/current/MANIFEST?rev=19336&op=file
==============================================================================
--- branches/upstream/librelative-perl/current/MANIFEST (added)
+++ branches/upstream/librelative-perl/current/MANIFEST Fri May 2 14:42:27 2008
@@ -1,0 +1,22 @@
+Build.PL
+Makefile.PL
+Changes
+MANIFEST
+META.yml
+README
+lib/relative.pm
+eg/README
+t/00-load.t
+t/BigApp/Report/Create.pm
+t/BigApp/Report.pm
+t/BigApp/Report/Publish.pm
+t/BigApp/Tools.pm
+t/BigApp/Utils.pm
+t/Enterprise/Framework/Base.pm
+t/Enterprise/Framework/Factory.pm
+t/pod-coverage.t
+t/pod.t
+t/relative-aliased.t
+t/relative-args.t
+t/relative-fail.t
+t/relative-plain.t
Added: branches/upstream/librelative-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/librelative-perl/current/META.yml?rev=19336&op=file
==============================================================================
--- branches/upstream/librelative-perl/current/META.yml (added)
+++ branches/upstream/librelative-perl/current/META.yml Fri May 2 14:42:27 2008
@@ -1,0 +1,21 @@
+---
+name: relative
+version: 0.04
+author:
+ - 'Sebastien Aperghis-Tramoni <sebastien at aperghis.net>'
+abstract: Load modules with relative names
+license: perl
+resources:
+ license: http://dev.perl.org/licenses/
+requires:
+ UNIVERSAL::require: 0
+build_requires:
+ Test::More: 0
+provides:
+ relative:
+ file: lib/relative.pm
+ version: 0.04
+generated_by: Module::Build version 0.2808
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.2.html
+ version: 1.2
Added: branches/upstream/librelative-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/librelative-perl/current/Makefile.PL?rev=19336&op=file
==============================================================================
--- branches/upstream/librelative-perl/current/Makefile.PL (added)
+++ branches/upstream/librelative-perl/current/Makefile.PL Fri May 2 14:42:27 2008
@@ -1,0 +1,20 @@
+use strict;
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ NAME => 'relative',
+ license => 'perl',
+ AUTHOR => 'Sebastien Aperghis-Tramoni <sebastien at aperghis.net>',
+ VERSION_FROM => 'lib/relative.pm',
+ ABSTRACT_FROM => 'lib/relative.pm',
+ PREREQ_PM => {
+ # prereqs
+ 'UNIVERSAL::require' => 0,
+
+ # build/tests prereqs
+ 'Test::More' => 0,
+ },
+ PL_FILES => {},
+ dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
+ clean => { FILES => 'relative-*' },
+);
Added: branches/upstream/librelative-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/librelative-perl/current/README?rev=19336&op=file
==============================================================================
--- branches/upstream/librelative-perl/current/README (added)
+++ branches/upstream/librelative-perl/current/README Fri May 2 14:42:27 2008
@@ -1,0 +1,63 @@
+NAME
+
+ relative - Load modules with relative names
+
+
+DESCRIPTION
+
+ This module allows you to load modules using only parts of their name,
+ relatively to the current module or to a given module. Module names are
+ by default searched below the current module, but can be searched upper
+ in the hierarchy using the "..::" syntax.
+
+ In order to further loosen the namespace coupling, "import" returns the
+ full names of the loaded modules, making object-oriented code easier to
+ write.
+
+
+INSTALLATION
+
+ To install this module, run the following commands:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+ Alternatively, to install with Module::Build, you can use the
+ following commands:
+
+ perl Build.PL
+ ./Build
+ ./Build test
+ ./Build install
+
+
+SUPPORT AND DOCUMENTATION
+
+ After installing, you can find documentation for this module with
+ the perldoc command.
+
+ perldoc relative
+
+ You can also look for information at:
+
+ Search CPAN
+ http://search.cpan.org/dist/relative
+
+ CPAN Request Tracker:
+ http://rt.cpan.org/NoAuth/Bugs.html?Dist=relative
+
+ AnnoCPAN, annotated CPAN documentation:
+ http://annocpan.org/dist/relative
+
+ CPAN Ratings:
+ http://cpanratings.perl.org/d/relative
+
+
+COPYRIGHT AND LICENCE
+
+ Copyright (C) 2007 Sébastien Aperghis-Tramoni
+
+ This program is free software; you can redistribute it and/or modify
+ it under the same terms as Perl itself.
Added: branches/upstream/librelative-perl/current/eg/README
URL: http://svn.debian.org/wsvn/branches/upstream/librelative-perl/current/eg/README?rev=19336&op=file
==============================================================================
--- branches/upstream/librelative-perl/current/eg/README (added)
+++ branches/upstream/librelative-perl/current/eg/README Fri May 2 14:42:27 2008
@@ -1,0 +1,1 @@
+See examples in the documentation and in the tests.
Added: branches/upstream/librelative-perl/current/lib/relative.pm
URL: http://svn.debian.org/wsvn/branches/upstream/librelative-perl/current/lib/relative.pm?rev=19336&op=file
==============================================================================
--- branches/upstream/librelative-perl/current/lib/relative.pm (added)
+++ branches/upstream/librelative-perl/current/lib/relative.pm Fri May 2 14:42:27 2008
@@ -1,0 +1,294 @@
+package relative;
+use strict;
+use Carp;
+use UNIVERSAL::require;
+
+{
+ no strict "vars";
+ $VERSION = '0.04';
+}
+
+=head1 NAME
+
+relative - Load modules with relative names
+
+=head1 VERSION
+
+Version 0.04
+
+=cut
+
+sub import {
+ return if @_ <= 1; # called with no args
+ my ($package, @args) = @_;
+ my ($caller) = caller();
+ my @loaded = ();
+
+ # read the optional parameters
+ my %param = ();
+
+ if (ref $args[0] eq 'HASH') {
+ %param = %{shift @args}
+ }
+ elsif (ref $args[0] eq 'ARRAY') {
+ %param = @{shift @args}
+ }
+
+ # go through the args list, looking to parameters with the dash syntax,
+ # and module names and optional arguments
+ my %args_for = (); # modules arguments
+ my @modules = (); # will be filled with only the module names
+ my $prev = "";
+
+ for my $item (@args) {
+ # if $prev is true, the previous thing (parameter or module name)
+ # is expecting a value
+ if ($prev) {
+ # this is a parameter
+ if (index($prev, "-") == 0) {
+ $param{substr($prev, 1)} = $item;
+ $prev = "";
+ }
+ # this is a module name
+ else {
+ push @modules, $prev;
+
+ # this isn't a ref, so the previous module is just stored
+ # and the current item becomes the new $prev
+ if (not ref $item) {
+ $prev = $item;
+ }
+ # this is an arrayref, which will be used as the import list
+ # for the module name in $prev
+ elsif (ref $item eq "ARRAY") {
+ $args_for{$prev} = $item;
+ $prev = "";
+ }
+ else {
+ my $that = "a ".lc(ref $item)."ref";
+ croak "error: Don't know how to deal with $that (after '$prev')";
+ }
+ }
+ }
+ else {
+ if ($item eq "-aliased") {
+ # -aliased is a flag, so it doesn't expect a value
+ $param{aliased} = 1
+ }
+ else {
+ $prev = $item
+ }
+ }
+ }
+
+ push @modules, $prev if $prev;
+
+ # determine the base name
+ my $base = exists $param{to} ? $param{to} : $caller;
+
+ # load the modules
+ for my $relname (@modules) {
+ # resolve the module relative name to absolute name
+ my $module = "$base\::$relname";
+ 1 while $module =~ s/::\w+::(?:\.\.)?::/::/g;
+ $module =~ s/^:://;
+
+ # load the module, die if it failed
+ $module->require or croak _clean($@);
+
+ # import the symbols from the loaded module into the caller module
+ if (exists $args_for{$relname}) {
+ my $args = $args_for{$relname};
+
+ # an arguments list has been defined, but only call import if
+ # there are some arguments
+ if (@$args) {
+ my $args_str = join ", ", map {"q/\Q$_\E/"} @$args;
+ eval qq{ package $caller; $module->import($args_str); 1 }
+ or croak _clean($@);
+ }
+ }
+ else {
+ # use the default import method
+ eval qq{ package $caller; $module->import; 1 } or croak _clean($@);
+ }
+
+ # define alias if asked to
+ if ($param{aliased}) {
+ my ($alias) = $module =~ /\b(\w+)$/;
+ eval qq{ package $caller; sub $alias () { q/$module/ } };
+ }
+
+ # keep a list of the loaded modules
+ push @loaded, $module;
+ }
+
+ return wantarray ? @loaded : $loaded[-1]
+}
+
+
+sub _clean {
+ my ($msg) = @_;
+ $msg =~ s/ at .*relative.pm line \d+\.\s*$//s;
+ return $msg
+}
+
+
+=head1 SYNOPSIS
+
+ package BigApp::Report;
+
+ use relative qw(Create Publish);
+ # loads BigApp::Report::Create, BigApp::Report::Publish
+
+ use relative qw(..::Utils);
+ # loads BigApp::Utils
+
+ use relative -to => "Enterprise::Framework" => qw(Base Factory);
+ # loads Enterprise::Framework::Base, Enterprise::Framework::Factory
+
+
+=head1 DESCRIPTION
+
+This module allows you to load modules using only parts of their name,
+relatively to the current module or to a given module. Module names are
+by default searched below the current module, but can be searched upper
+in the hierarchy using the C<..::> syntax.
+
+In order to further loosen the namespace coupling, C<import> returns
+the full names of the loaded modules, making object-oriented code easier
+to write:
+
+ use relative;
+
+ my ($Maker, $Publisher) = import relative qw(Create Publish);
+ my $report = $Maker->new;
+ my $publisher = $Publisher->new;
+
+ my ($Base, $Factory) = import relative -to => "Enterprise::Framework"
+ => qw(Base Factory);
+ my $thing = $Factory->new;
+
+This can also be written using aliases:
+
+ use relative -aliased => qw(Create Publish);
+ my $report = Create->new;
+ my $publisher = Publisher->new;
+
+ use relative -to => "Enterprise::Framework", -aliased => qw(Base Factory);
+ my $thing = Factory->new;
+
+
+=head1 IMPORT OPTIONS
+
+Import options can be given as an hashref or an arrayref as the first
+argument:
+
+ # options as a hashref
+ import relative { param => value, ... }, qw(Name ...);
+
+ # options as an arrayref
+ import relative [ param => value, ... ], qw(Name ...);
+
+In order to simplyfing syntax, options can also be given as dash-prefixed
+params:
+
+ import relative -param => value, qw(name ...);
+
+Available options:
+
+=over
+
+=item *
+
+C<to> can be used to indicate another hierarchy to search modules inside.
+
+B<Examples>
+
+ # in a hashref:
+ import relative { to => "Some::Other::Namespace" }, qw(Other Modules);
+
+ # as dash-param:
+ import relative -to => "Some::Other::Namespace", qw(Other Modules);
+
+=item *
+
+C<aliased> will create constants, named with the last component of each
+loaded module, returning its corresponding full name. Yes, this feature
+is very similar to what C<aliased> does as it was added per Ovid request C<:-)>
+
+B<Examples>
+
+ # in a hashref:
+ import relative { aliased => 1 }, qw(Whack Zlonk);
+ my $frob = Whack->fizzle;
+
+ # as dash-param:
+ import relative -aliased, qw(Whack Zlonk);
+ my $frob = Whack->fizzle;
+
+=back
+
+C<import> will C<die> as soon as a module can't be loaded.
+
+C<import> returns the full names of the loaded modules when called in
+list context, or the last one when called in scalar context.
+
+
+=head1 AUTHOR
+
+SE<eacute>bastien Aperghis-Tramoni, C<< <sebastien at aperghis.net> >>
+
+=head1 BUGS
+
+Please report any bugs or feature requests to
+C<bug-relative at rt.cpan.org>, or through the web interface at
+L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=relative>.
+I will be notified, and then you'll automatically be notified of progress
+on your bug as I make changes.
+
+=head1 SUPPORT
+
+You can find documentation for this module with the perldoc command.
+
+ perldoc relative
+
+You can also look for information at:
+
+=over 4
+
+=item * AnnoCPAN: Annotated CPAN documentation
+
+L<http://annocpan.org/dist/relative>
+
+=item * CPAN Ratings
+
+L<http://cpanratings.perl.org/d/relative>
+
+=item * RT: CPAN's request tracker
+
+L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=relative>
+
+=item * Search CPAN
+
+L<http://search.cpan.org/dist/relative>
+
+=back
+
+
+=head1 ACKNOWLEDGEMENTS
+
+Thanks to Aristotle Pagaltzis, Andy Armstrong, Ken Williams
+and Curtis Poe for their suggestions and ideas.
+
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2007 SE<eacute>bastien Aperghis-Tramoni, all rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+=cut
+
+"evitaler fo dnE" # "End of relative"
Added: branches/upstream/librelative-perl/current/t/00-load.t
URL: http://svn.debian.org/wsvn/branches/upstream/librelative-perl/current/t/00-load.t?rev=19336&op=file
==============================================================================
--- branches/upstream/librelative-perl/current/t/00-load.t (added)
+++ branches/upstream/librelative-perl/current/t/00-load.t Fri May 2 14:42:27 2008
@@ -1,0 +1,9 @@
+#!perl -T
+
+use Test::More tests => 1;
+
+BEGIN {
+ use_ok( 'relative' );
+}
+
+diag( "Testing relative $relative::VERSION, Perl $], $^X" );
Added: branches/upstream/librelative-perl/current/t/BigApp/Report.pm
URL: http://svn.debian.org/wsvn/branches/upstream/librelative-perl/current/t/BigApp/Report.pm?rev=19336&op=file
==============================================================================
--- branches/upstream/librelative-perl/current/t/BigApp/Report.pm (added)
+++ branches/upstream/librelative-perl/current/t/BigApp/Report.pm Fri May 2 14:42:27 2008
@@ -1,0 +1,81 @@
+package BigApp::Report;
+use Test::More;
+
+my @loaded;
+my $loaded;
+
+# load a sibling module, first syntax
+use_ok( relative => qw(..::Utils) );
+is( $BigApp::Utils::VERSION, 3.12,
+ "checking that BigApp::Utils was actually loaded" );
+
+ at loaded = import relative qw(..::Utils);
+is_deeply( \@loaded, ["BigApp::Utils"],
+ "checking what import returns in list context" );
+
+$loaded = import relative qw(..::Utils);
+is( $loaded, "BigApp::Utils",
+ "checking what import returns in scalar context" );
+
+# load a sibling module, short syntax
+use_ok( relative => qw(::Tools) );
+is( $BigApp::Tools::VERSION, 3.45,
+ "checking that BigApp::Tools was actually loaded" );
+
+ at loaded = import relative qw(::Tools);
+is_deeply( \@loaded, ["BigApp::Tools"],
+ "checking what import returns in list context" );
+
+$loaded = import relative qw(::Tools);
+is( $loaded, "BigApp::Tools",
+ "checking what import returns in scalar context" );
+
+# load two modules
+use_ok( relative => qw(Create Publish) );
+is( $BigApp::Report::Create::VERSION, 2.16,
+ "checking that BigApp::Report::Create was actually loaded" );
+is( $BigApp::Report::Publish::VERSION, 2.53,
+ "checking that BigApp::Report::Publish was actually loaded" );
+
+ at loaded = import relative qw(Create Publish);
+is_deeply( \@loaded, ["BigApp::Report::Create", "BigApp::Report::Publish"],
+ "checking what import returns in list context" );
+
+$loaded = import relative qw(Create Publish);
+is( $loaded, "BigApp::Report::Publish",
+ "checking what import returns in scalar context" );
+
+# check that the methods have been imported
+can_ok( "BigApp::Report::Create", qw(new_report) );
+can_ok( __PACKAGE__, qw(new_report) );
+my $report = eval { new_report() };
+is( $@, "", "calling new_report()" );
+isa_ok( $report, "BigApp::Report::Create", "checking that \$report" );
+
+can_ok( "BigApp::Report::Publish", qw(render) );
+can_ok( __PACKAGE__, qw(render) );
+my $r = eval { render($report) };
+is( $@, "", "calling render()" );
+is( $r, 1, "checking result code" );
+
+# load modules relatively to another hierarchy
+use_ok( relative => -to => "Enterprise::Framework" => qw(Base Factory) );
+is( $Enterprise::Framework::Base::VERSION, "10.5.32.14",
+ "checking that Enterprise::Framework::Base was actually loaded" );
+is( $Enterprise::Framework::Factory::VERSION, "10.5.43.58",
+ "checking that Enterprise::Framework::Factory was actually loaded" );
+
+ at loaded = import relative -to => "Enterprise::Framework" => qw(Base Factory);
+is_deeply( \@loaded, ["Enterprise::Framework::Base", "Enterprise::Framework::Factory"],
+ "checking what import returns in list context" );
+
+$loaded = import relative -to => "Enterprise::Framework" => qw(Factory Base);
+is( $loaded, "Enterprise::Framework::Base",
+ "checking what import returns in scalar context" );
+
+can_ok( $loaded, qw(new) );
+my $obj = eval { $loaded->new() };
+is( $@, "", "calling $loaded->new()" );
+isa_ok( $obj, $loaded, "checking that \$obj" );
+
+1
Added: branches/upstream/librelative-perl/current/t/BigApp/Report/Create.pm
URL: http://svn.debian.org/wsvn/branches/upstream/librelative-perl/current/t/BigApp/Report/Create.pm?rev=19336&op=file
==============================================================================
--- branches/upstream/librelative-perl/current/t/BigApp/Report/Create.pm (added)
+++ branches/upstream/librelative-perl/current/t/BigApp/Report/Create.pm Fri May 2 14:42:27 2008
@@ -1,0 +1,7 @@
+package BigApp::Report::Create;
+require Exporter;
+$VERSION = 2.16;
+ at ISA = qw(Exporter);
+ at EXPORT = qw(new_report);
+sub new_report { return bless {} }
+1
Added: branches/upstream/librelative-perl/current/t/BigApp/Report/Publish.pm
URL: http://svn.debian.org/wsvn/branches/upstream/librelative-perl/current/t/BigApp/Report/Publish.pm?rev=19336&op=file
==============================================================================
--- branches/upstream/librelative-perl/current/t/BigApp/Report/Publish.pm (added)
+++ branches/upstream/librelative-perl/current/t/BigApp/Report/Publish.pm Fri May 2 14:42:27 2008
@@ -1,0 +1,7 @@
+package BigApp::Report::Publish;
+require Exporter;
+$VERSION = 2.53;
+ at ISA = qw(Exporter);
+ at EXPORT = qw(render);
+sub render { 1 }
+1
Added: branches/upstream/librelative-perl/current/t/BigApp/Tools.pm
URL: http://svn.debian.org/wsvn/branches/upstream/librelative-perl/current/t/BigApp/Tools.pm?rev=19336&op=file
==============================================================================
--- branches/upstream/librelative-perl/current/t/BigApp/Tools.pm (added)
+++ branches/upstream/librelative-perl/current/t/BigApp/Tools.pm Fri May 2 14:42:27 2008
@@ -1,0 +1,3 @@
+package BigApp::Tools;
+$VERSION = 3.45;
+1
Added: branches/upstream/librelative-perl/current/t/BigApp/Utils.pm
URL: http://svn.debian.org/wsvn/branches/upstream/librelative-perl/current/t/BigApp/Utils.pm?rev=19336&op=file
==============================================================================
--- branches/upstream/librelative-perl/current/t/BigApp/Utils.pm (added)
+++ branches/upstream/librelative-perl/current/t/BigApp/Utils.pm Fri May 2 14:42:27 2008
@@ -1,0 +1,3 @@
+package BigApp::Utils;
+$VERSION = 3.12;
+1
Added: branches/upstream/librelative-perl/current/t/Enterprise/Framework/Base.pm
URL: http://svn.debian.org/wsvn/branches/upstream/librelative-perl/current/t/Enterprise/Framework/Base.pm?rev=19336&op=file
==============================================================================
--- branches/upstream/librelative-perl/current/t/Enterprise/Framework/Base.pm (added)
+++ branches/upstream/librelative-perl/current/t/Enterprise/Framework/Base.pm Fri May 2 14:42:27 2008
@@ -1,0 +1,4 @@
+package Enterprise::Framework::Base;
+$VERSION = "10.5.32.14";
+sub new { bless {} }
+1
Added: branches/upstream/librelative-perl/current/t/Enterprise/Framework/Factory.pm
URL: http://svn.debian.org/wsvn/branches/upstream/librelative-perl/current/t/Enterprise/Framework/Factory.pm?rev=19336&op=file
==============================================================================
--- branches/upstream/librelative-perl/current/t/Enterprise/Framework/Factory.pm (added)
+++ branches/upstream/librelative-perl/current/t/Enterprise/Framework/Factory.pm Fri May 2 14:42:27 2008
@@ -1,0 +1,3 @@
+package Enterprise::Framework::Factory;
+$VERSION = "10.5.43.58";
+1
Added: branches/upstream/librelative-perl/current/t/pod-coverage.t
URL: http://svn.debian.org/wsvn/branches/upstream/librelative-perl/current/t/pod-coverage.t?rev=19336&op=file
==============================================================================
--- branches/upstream/librelative-perl/current/t/pod-coverage.t (added)
+++ branches/upstream/librelative-perl/current/t/pod-coverage.t Fri May 2 14:42:27 2008
@@ -1,0 +1,6 @@
+#!perl
+use strict;
+use Test::More;
+plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage"
+ unless eval "use Test::Pod::Coverage 1.04; 1";
+all_pod_coverage_ok();
Added: branches/upstream/librelative-perl/current/t/pod.t
URL: http://svn.debian.org/wsvn/branches/upstream/librelative-perl/current/t/pod.t?rev=19336&op=file
==============================================================================
--- branches/upstream/librelative-perl/current/t/pod.t (added)
+++ branches/upstream/librelative-perl/current/t/pod.t Fri May 2 14:42:27 2008
@@ -1,0 +1,6 @@
+#!perl
+use strict;
+use Test::More;
+plan skip_all => "Test::Pod 1.14 required for testing POD"
+ unless eval "use Test::Pod 1.14; 1";
+all_pod_files_ok();
Added: branches/upstream/librelative-perl/current/t/relative-aliased.t
URL: http://svn.debian.org/wsvn/branches/upstream/librelative-perl/current/t/relative-aliased.t?rev=19336&op=file
==============================================================================
--- branches/upstream/librelative-perl/current/t/relative-aliased.t (added)
+++ branches/upstream/librelative-perl/current/t/relative-aliased.t Fri May 2 14:42:27 2008
@@ -1,0 +1,33 @@
+#!perl -Tw
+use strict;
+use Test::More;
+use lib "t";
+
+plan tests => 11;
+
+use_ok( "relative" );
+
+# load modules and create aliases from Enterprise::Framework
+my $loaded = eval { import relative -to => "Enterprise::Framework" => -aliased => qw(Factory Base) };
+is( $@, "", "load modules and create aliases" );
+
+# check that the aliases were created
+can_ok( __PACKAGE__, "Base", "Factory" );
+
+can_ok( $loaded, qw(new) );
+my $obj = eval { Base()->new() };
+is( $@, "", "calling Base()->new()" );
+isa_ok( $obj, $loaded, "checking that \$obj" );
+
+
+# load modules and create aliases from BigApp
+$loaded = eval { import relative -to => "BigApp" => -aliased => qw(Report::Publish Report::Create) };
+is( $@, "", "load modules and create aliases" );
+
+# check that the aliases were created
+can_ok( __PACKAGE__, "Create", "Publish" );
+
+can_ok( $loaded, qw(new_report) );
+my $report = eval { Create()->new_report() };
+is( $@, "", "calling Create()->new_report()" );
+isa_ok( $report, $loaded, "checking that \$report" );
Added: branches/upstream/librelative-perl/current/t/relative-args.t
URL: http://svn.debian.org/wsvn/branches/upstream/librelative-perl/current/t/relative-args.t?rev=19336&op=file
==============================================================================
--- branches/upstream/librelative-perl/current/t/relative-args.t (added)
+++ branches/upstream/librelative-perl/current/t/relative-args.t Fri May 2 14:42:27 2008
@@ -1,0 +1,31 @@
+#!perl -Tw
+package BigApp::Report;
+use strict;
+use Test::More;
+use lib "t";
+
+plan tests => 7;
+
+use_ok( "relative" );
+
+# load modules with empty import lists
+my @loaded = import relative Create => [], "::Tools", Publish => [], "::Utils";
+is_deeply(
+ \@loaded,
+ [qw(BigApp::Report::Create BigApp::Tools BigApp::Report::Publish BigApp::Utils)],
+ "check that the modules were correctly loaded"
+);
+ok( !exists $BigApp::Report::{new_report},
+ "check that the function 'new_report' was not imported" );
+ok( !exists $BigApp::Report::{render},
+ "check that the function 'render' was not imported" );
+
+# load modules with non-empty import lists
+ at loaded = import relative Create => ["new_report"], "::Tools", Publish => ["render"], "::Utils";
+is_deeply(
+ \@loaded,
+ [qw(BigApp::Report::Create BigApp::Tools BigApp::Report::Publish BigApp::Utils)],
+ "check that the modules were correctly loaded"
+);
+can_ok( __PACKAGE__, "new_report" );
+can_ok( __PACKAGE__, "render" );
Added: branches/upstream/librelative-perl/current/t/relative-fail.t
URL: http://svn.debian.org/wsvn/branches/upstream/librelative-perl/current/t/relative-fail.t?rev=19336&op=file
==============================================================================
--- branches/upstream/librelative-perl/current/t/relative-fail.t (added)
+++ branches/upstream/librelative-perl/current/t/relative-fail.t Fri May 2 14:42:27 2008
@@ -1,0 +1,14 @@
+#!perl -Tw
+package BigApp::Report;
+use strict;
+use Test::More;
+use lib "t";
+
+plan tests => 2;
+
+use_ok( "relative" );
+
+# check that loading a non-existing module results in failure
+my $module = "NoSuchModule";
+eval { import relative $module };
+like( $@, "/Can't locate BigApp/Report/$module.pm in \@INC/", "checking error" );
Added: branches/upstream/librelative-perl/current/t/relative-plain.t
URL: http://svn.debian.org/wsvn/branches/upstream/librelative-perl/current/t/relative-plain.t?rev=19336&op=file
==============================================================================
--- branches/upstream/librelative-perl/current/t/relative-plain.t (added)
+++ branches/upstream/librelative-perl/current/t/relative-plain.t Fri May 2 14:42:27 2008
@@ -1,0 +1,7 @@
+#!perl -Tw
+use strict;
+use Test::More;
+use lib "t";
+
+plan tests => 30;
+use_ok( "BigApp::Report" );
More information about the Pkg-perl-cvs-commits
mailing list