r39294 - in /branches/upstream/libfind-lib-perl: ./ current/ current/lib/ current/lib/Find/ current/t/ current/t/libs/ current/t/moretests/ current/t/moretests/mytestlib/ current/t/mylib/

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Sat Jul 4 00:37:23 UTC 2009


Author: jawnsy-guest
Date: Sat Jul  4 00:37:17 2009
New Revision: 39294

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=39294
Log:
[svn-inject] Installing original source of libfind-lib-perl

Added:
    branches/upstream/libfind-lib-perl/
    branches/upstream/libfind-lib-perl/current/
    branches/upstream/libfind-lib-perl/current/Changes
    branches/upstream/libfind-lib-perl/current/MANIFEST
    branches/upstream/libfind-lib-perl/current/MANIFEST.SKIP
    branches/upstream/libfind-lib-perl/current/META.yml
    branches/upstream/libfind-lib-perl/current/Makefile.PL
    branches/upstream/libfind-lib-perl/current/README
    branches/upstream/libfind-lib-perl/current/lib/
    branches/upstream/libfind-lib-perl/current/lib/Find/
    branches/upstream/libfind-lib-perl/current/lib/Find/Lib.pm
    branches/upstream/libfind-lib-perl/current/t/
    branches/upstream/libfind-lib-perl/current/t/00-compile.t
    branches/upstream/libfind-lib-perl/current/t/01-addinc.t
    branches/upstream/libfind-lib-perl/current/t/02-use.t
    branches/upstream/libfind-lib-perl/current/t/03-missinginc.t
    branches/upstream/libfind-lib-perl/current/t/04-import.t
    branches/upstream/libfind-lib-perl/current/t/05-complex.t
    branches/upstream/libfind-lib-perl/current/t/06-empty.t
    branches/upstream/libfind-lib-perl/current/t/07-libs.t
    branches/upstream/libfind-lib-perl/current/t/08-dupe-slashes.t
    branches/upstream/libfind-lib-perl/current/t/libs/
    branches/upstream/libfind-lib-perl/current/t/libs/Foo.pm
    branches/upstream/libfind-lib-perl/current/t/moretests/
    branches/upstream/libfind-lib-perl/current/t/moretests/01-relative.t
    branches/upstream/libfind-lib-perl/current/t/moretests/02-dollar0-begin.t
    branches/upstream/libfind-lib-perl/current/t/moretests/02-dollar0.t
    branches/upstream/libfind-lib-perl/current/t/moretests/03-chdir-begin.t
    branches/upstream/libfind-lib-perl/current/t/moretests/03-chdir-topbegin.t
    branches/upstream/libfind-lib-perl/current/t/moretests/03-chdir.t
    branches/upstream/libfind-lib-perl/current/t/moretests/03-pwd-begin.t
    branches/upstream/libfind-lib-perl/current/t/moretests/04-symlinks.t
    branches/upstream/libfind-lib-perl/current/t/moretests/mytestlib/
    branches/upstream/libfind-lib-perl/current/t/moretests/mytestlib/MyLib.pm
    branches/upstream/libfind-lib-perl/current/t/moretests/symlink_test.pl
    branches/upstream/libfind-lib-perl/current/t/mylib/
    branches/upstream/libfind-lib-perl/current/t/mylib/MyLib.pm
    branches/upstream/libfind-lib-perl/current/t/mylib/MyLibNoTest.pm
    branches/upstream/libfind-lib-perl/current/t/testutils.pl

Added: branches/upstream/libfind-lib-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/Changes?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/Changes (added)
+++ branches/upstream/libfind-lib-perl/current/Changes Sat Jul  4 00:37:17 2009
@@ -1,0 +1,25 @@
+Revision history for Find-Lib
+
+0.06    Thu May  8 22:30:00 PDT 2009
+        - Still working on the test suite (I wish I could use cpantesters
+        without making a release)
+
+0.05    Thu May  7 19:52:00 PDT 2009
+        - Minor fixes attempt for the test suite (CPANTESTERS)
+
+0.04    Mon May  5 21:05:00 PDT 2009
+        - Fixed the test suite for a warning that generates tons of FAIL report
+
+0.03    Mon May  5 14:05:00 PDT 2009
+        - Uses $ENV{PWD} to allow more DWIM, compared to the previous method
+          that used resolved paths all over the place.
+          Teamed up with Jonathan Steinert (hachi) for this idea.
+
+0.02    Sat Dec  8 11:16:09 PDT 2007
+        - POD fixes
+        - Changed tests suite to make it compatible with perl 5.005
+          (hopefully)
+
+0.01    Fri Dec  7 19:30:31 PDT 2007
+        First version, released on an unsuspecting world.
+

Added: branches/upstream/libfind-lib-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/MANIFEST?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/MANIFEST (added)
+++ branches/upstream/libfind-lib-perl/current/MANIFEST Sat Jul  4 00:37:17 2009
@@ -1,0 +1,31 @@
+Changes
+lib/Find/Lib.pm
+Makefile.PL
+MANIFEST			This list of files
+MANIFEST.SKIP
+META.yml
+README
+t/00-compile.t
+t/01-addinc.t
+t/02-use.t
+t/03-missinginc.t
+t/04-import.t
+t/05-complex.t
+t/06-empty.t
+t/07-libs.t
+t/libs/Foo.pm
+t/moretests/01-relative.t
+t/moretests/02-dollar0-begin.t
+t/moretests/02-dollar0.t
+t/moretests/03-chdir-begin.t
+t/moretests/03-chdir-topbegin.t
+t/moretests/03-chdir.t
+t/moretests/mytestlib/MyLib.pm
+t/mylib/MyLib.pm
+t/testutils.pl
+t/moretests/symlink_test.pl
+t/08-dupe-slashes.t
+t/moretests/03-pwd-begin.t
+t/moretests/04-symlinks.t
+t/moretests/symlink_test.pl
+t/mylib/MyLibNoTest.pm

Added: branches/upstream/libfind-lib-perl/current/MANIFEST.SKIP
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/MANIFEST.SKIP?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/MANIFEST.SKIP (added)
+++ branches/upstream/libfind-lib-perl/current/MANIFEST.SKIP Sat Jul  4 00:37:17 2009
@@ -1,0 +1,27 @@
+.shipit
+
+# Avoid version control files.
+\B\.git\b
+\B\.gitignore\b
+\bRCS\b
+\bCVS\b
+,v$
+\B\.svn\b
+
+# Avoid Makemaker generated and utility files.
+\bMANIFEST\.bak
+\bMakefile$
+\bblib/
+\bMakeMaker-\d
+\bpm_to_blib$
+
+# Avoid Module::Build generated and utility files.
+\bBuild$
+\b_build/
+
+# Avoid temp and backup files.
+~$
+\.old$
+\#$
+\b\.#
+

Added: branches/upstream/libfind-lib-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/META.yml?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/META.yml (added)
+++ branches/upstream/libfind-lib-perl/current/META.yml Sat Jul  4 00:37:17 2009
@@ -1,0 +1,12 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
+name:         Find-Lib
+version:      0.06
+version_from: lib/Find/Lib.pm
+installdirs:  site
+requires:
+    File::Spec:                    0
+    Test::More:                    0
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.30

Added: branches/upstream/libfind-lib-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/Makefile.PL?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/Makefile.PL (added)
+++ branches/upstream/libfind-lib-perl/current/Makefile.PL Sat Jul  4 00:37:17 2009
@@ -1,0 +1,18 @@
+use strict;
+use warnings;
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+    NAME                => 'Find::Lib',
+    AUTHOR              => 'Yann Kerherve <yannk at cpan.org>',
+    VERSION_FROM        => 'lib/Find/Lib.pm',
+    ABSTRACT_FROM       => 'lib/Find/Lib.pm',
+    PL_FILES            => {},
+    PREREQ_PM => {
+        'Test::More' => 0,
+        'File::Spec' => 0,
+    },
+    test                => { TESTS => 't/*.t t/moretests/*t' },
+    dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
+    clean               => { FILES => 'Find-Lib-*' },
+);

Added: branches/upstream/libfind-lib-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/README?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/README (added)
+++ branches/upstream/libfind-lib-perl/current/README Sat Jul  4 00:37:17 2009
@@ -1,0 +1,52 @@
+Find-Lib
+
+The README is used to introduce the module and provide instructions on
+how to install the module, any machine dependencies it may have (for
+example C compilers and installed libraries) and any other information
+that should be provided before the module is installed.
+
+A README file is required for CPAN modules since CPAN extracts the README
+file from a module distribution so that people browsing the archive
+can use it to get an idea of the module's uses. It is usually a good idea
+to provide version information here so that people can decide whether
+fixes for the module are worth downloading.
+
+
+INSTALLATION
+
+To install this module, run the following commands:
+
+	perl Makefile.PL
+	make
+	make test
+	make install
+
+SUPPORT AND DOCUMENTATION
+
+After installing, you can find documentation for this module with the
+perldoc command.
+
+    perldoc Find::Lib
+
+You can also look for information at:
+
+    RT, CPAN's request tracker
+        http://rt.cpan.org/NoAuth/Bugs.html?Dist=Find-Lib
+
+    AnnoCPAN, Annotated CPAN documentation
+        http://annocpan.org/dist/Find-Lib
+
+    CPAN Ratings
+        http://cpanratings.perl.org/d/Find-Lib
+
+    Search CPAN
+        http://search.cpan.org/dist/Find-Lib
+
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2007 Yann Kerherve
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+

Added: branches/upstream/libfind-lib-perl/current/lib/Find/Lib.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/lib/Find/Lib.pm?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/lib/Find/Lib.pm (added)
+++ branches/upstream/libfind-lib-perl/current/lib/Find/Lib.pm Sat Jul  4 00:37:17 2009
@@ -1,0 +1,275 @@
+package Find::Lib;
+use strict;
+use warnings;
+use lib;
+
+use File::Spec::Functions qw( catpath splitpath rel2abs catdir splitdir );
+use vars qw/$Base $VERSION @base/;
+use vars qw/$Script/; # compat
+
+=head1 NAME
+
+Find::Lib - Helper to smartly find libs to use in the filesystem tree
+
+=head1 VERSION
+
+Version 0.02
+
+=cut
+
+$VERSION = '0.06';
+
+=head1 SYNOPSIS
+
+    #!/usr/bin/perl -w;
+    use strict;
+
+    ## simple usage
+    use Find::Lib '../mylib';
+
+    ## with a Bootstap module
+    use Find::Lib '../mylib' => 'My::Bootstrap';
+
+    ## pass import parameters to your Bootstrap module
+    use Find::Lib '../mylib' => 'My::Bootstrap', test => 1, dbi => 'sqlite';
+
+    ## If you like verbose, or if you don't have a Bootstrap module
+    use Find::Lib libs => [ 'lib', '../lib', 'devlib' ];
+    use My::Test tests => 10;
+    use My::Module;
+
+=head1 DESCRIPTION
+
+The purpose of this module is to replace
+
+    use FindBin;
+    use lib "$FindBin::Bin/../bootstrap/lib";
+    use My::Bootstrap %param;
+
+with something shorter. This is specially useful if your project has a lot
+of scripts (For instance tests scripts).
+
+    use Find::Lib '../bootstrap/lib' => 'My::Bootstrap', %param;
+
+does exactly that without using L<FindBin> module, and has the important
+propriety to do what you mean regarding symlinks and '..'.
+
+Note that the role of a Bootstrap module is actually to install more
+library paths in C<@INC> and to use more modules necessary to your application.
+It keeps your scripts nice and clean.
+
+On the other hand, if you don't want/need/have a Bootstrap module, you can
+still use L<Find::Lib> to automatically identify the relative locations of
+your libraries and add them to your C<@INC>; just use the expanded version
+as seen in the SYNOPSIS.
+
+=head1 DISCUSSION
+
+=head2 Installation and availability of this module
+
+The usefulness of this module is seriously reduced if L<Find::Lib> is not
+already in your @INC / $ENV{PERL5LIB} -- Chicken and egg problem. This is
+the big disavantage of L<FindBin> over L<Find::Lib>: FindBin is distributed
+with Perl. To mitigate that, you need to be sure of global availability of
+the module in the system (You could install it via your favorite package
+managment system for instance).
+
+=head2 modification of $0 and chdir (BEGIN blocks, other 'use')
+
+As soon as L<Find::Lib> is compiled it saves the location of the script and
+the initial cwd (current working directory), which are the two pieces of
+information the module relies on to interpret the relative path given by the
+calling program.
+
+If one of cwd, $ENV{PWD} or $0 is changed before Find::Lib has a chance to do
+its job, then Find::Lib will most probably die, saying "The script cannot be
+found". I don't know a workaround that. So be sure to load Find::Lib as soon
+as possible in your script to minimize problems (you are in control!).
+
+(some programs alter $0 to customize the diplay line of the process in
+the system process-list (C<ps> on unix).
+
+(Note, see L<perlvar> for explanation of $0)
+
+=head1 USAGE
+
+=head2 import
+
+All the work is done in import. So you need to 'use Find::Lib' and pass
+arguments to it.
+
+Recognized arguments are:
+
+=over 4
+
+=item C<libs>, a reference to a list of path to add to C<@INC>. The paths given
+are (should) be relative to the location of the current script. The paths won't
+be added unless the path actually exists on disk
+
+=item C<pkgs>, a reference to a hash containing package name as keys and
+arrayref of arguments (to import) as values. This is not really useful in
+itself, you'd better specify 'libs' in the import arguments and then use
+on seperate lines after it.
+
+=back
+
+The short forms implies that the first argument passed to import is not C<libs>
+or C<pkgs>. An example of usage is given in the SYNOPSIS section.
+
+=cut
+
+use Carp();
+
+$Script = $Base = guess_base();
+
+sub guess_base {
+    my $base;
+    $base = guess_shell_path();
+    return $base if $base && -e $base;
+    return guess_system_path();
+}
+
+sub guess_shell_path {
+    my ($volume, $path, $file) = splitpath( $ENV{PWD} );
+    my @path = splitdir $path;
+    pop @path unless $path[-1];
+    @base = (@path, $file);
+    my @zero = splitdir $0;
+    pop @zero; # get rid of the script
+    ## a clean base is also important for the pop business below
+    #@base = grep { $_ && $_ ne '.' } shell_resolve(\@base, \@zero);
+    @base = shell_resolve(\@base, \@zero);
+    return catpath( $volume, (catdir @base), '' );
+}
+
+## naive method, but really DWIM from a developer perspective
+sub shell_resolve {
+    my ($left, $right) = @_;
+    while (@$right && $right->[0] eq '.') { shift @$right }
+    while (@$right && $right->[0] eq '..') {
+        shift @$right;
+        ## chop off @left until we removed a significant path part
+        my $part;
+        while (@$left && !$part) {
+            $part = pop @$left;
+        }
+    }
+
+    return (@$left, @$right);
+}
+
+sub guess_system_path {
+    return catpath( (splitpath( rel2abs $0 ))[ 0, 1 ], '' );
+}
+
+sub import {
+    my $class = shift;
+    return unless @_;
+    my %param;
+
+    Carp::croak("The script/base dir cannot be found") unless -e $Base;
+
+    if ( ( $_[0] eq 'libs' or $_[0] eq 'pkgs' )
+        and ref $_[1] && ref $_[1] ne 'SCALAR' ) {
+
+        %param = @_;
+    }
+    else {
+        ## enters simple bootstrap mode:
+        ## 'libpath' => 'bootstrap package' => @arguments
+        $param{libs} = [ $_[0] ];
+        if ( $_[1] ) {
+            $param{pkgs} = { $_[1] => [ splice @_, 2 ] };
+        }
+    }
+
+    for ( reverse @{ $param{libs} || [] } ) {
+        my @lib = splitdir $_;
+        if (@lib && ! $lib[0]) {
+            # '/abs/olute/' path
+            lib->import($_);
+            next;
+        }
+        my $dir = catdir( shell_resolve( [ @base ], \@lib ) );
+        unless (-d $dir) {
+            ## Try the old way (<0.03)
+            $dir = catdir($Base, $_);
+        }
+        next unless -d $dir;
+        lib->import( $dir );
+    }
+
+    while (my ($pkg, $args) = each %{ $param{pkgs} || {} }) {
+        eval "require $pkg";
+        if ($@) {
+            die $@;
+        }
+        $pkg->import( @{ $args || [] } );
+    }
+}
+
+
+=head1 SEE ALSO
+
+L<FindBin>, L<FindBin::libs>, L<lib>, L<rlib>, L<local::lib>
+
+=head1 AUTHOR
+
+Yann Kerherve, C<< <yann.kerherve at gmail.com> >>
+
+=head1 BUGS
+
+Please report any bugs or feature requests to
+C<bug-find-lib at rt.cpan.org>, or through the web interface at
+L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Find-Lib>.
+I will be notified, and then you'll automatically be notified of progress on
+your bug as I make changes.
+
+=head1 ACKNOWLEDGEMENT
+
+Six Apart hackers nourrished the discussion that led to this module creation.
+
+Jonathan Steinert (hachi) for doing all the conception of 0.03 shell expansion
+mode with me.
+
+=head1 SUPPORT & CRITICS
+
+I welcome feedback about this module, don't hesitate to contact me regarding this
+module, usage or code.
+
+You can find documentation for this module with the perldoc command.
+
+    perldoc Find::Lib
+
+You can also look for information at:
+
+=over 4
+
+=item * AnnoCPAN: Annotated CPAN documentation
+
+L<http://annocpan.org/dist/Find-Lib>
+
+=item * CPAN Ratings
+
+L<http://cpanratings.perl.org/d/Find-Lib>
+
+=item * RT: CPAN's request tracker
+
+L<http://rt.cpan.org/NoAuth/Bugs.html?Find-Lib>
+
+=item * Search CPAN
+
+L<http://search.cpan.org/dist/Find-Lib>
+
+=back
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2007, 2009 Yann Kerherve, all rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+=cut
+
+1;

Added: branches/upstream/libfind-lib-perl/current/t/00-compile.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/00-compile.t?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/00-compile.t (added)
+++ branches/upstream/libfind-lib-perl/current/t/00-compile.t Sat Jul  4 00:37:17 2009
@@ -1,0 +1,4 @@
+use strict;
+use Test::More tests => 1;
+
+use_ok 'Find::Lib';

Added: branches/upstream/libfind-lib-perl/current/t/01-addinc.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/01-addinc.t?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/01-addinc.t (added)
+++ branches/upstream/libfind-lib-perl/current/t/01-addinc.t Sat Jul  4 00:37:17 2009
@@ -1,0 +1,9 @@
+use strict;
+use Test::More tests => 3;
+
+require 't/testutils.pl';
+
+use Find::Lib 'mylib';
+use_ok 'MyLib';
+
+in_inc( 'mylib' );

Added: branches/upstream/libfind-lib-perl/current/t/02-use.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/02-use.t?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/02-use.t (added)
+++ branches/upstream/libfind-lib-perl/current/t/02-use.t Sat Jul  4 00:37:17 2009
@@ -1,0 +1,9 @@
+use strict;
+use Test::More tests => 3;
+
+require 't/testutils.pl';
+
+use Find::Lib 'mylib', 'MyLib';
+
+ok my $path = $INC{ 'MyLib.pm' }, "MyLib used";
+like $path, qr/mylib/, "just to be sure :)";

Added: branches/upstream/libfind-lib-perl/current/t/03-missinginc.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/03-missinginc.t?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/03-missinginc.t (added)
+++ branches/upstream/libfind-lib-perl/current/t/03-missinginc.t Sat Jul  4 00:37:17 2009
@@ -1,0 +1,7 @@
+use strict;
+use Test::More tests => 1;
+
+require 't/testutils.pl';
+
+use Find::Lib 'unexistent';
+not_in_inc( 'unexistent' );

Added: branches/upstream/libfind-lib-perl/current/t/04-import.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/04-import.t?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/04-import.t (added)
+++ branches/upstream/libfind-lib-perl/current/t/04-import.t Sat Jul  4 00:37:17 2009
@@ -1,0 +1,9 @@
+use strict;
+use Test::More tests => 3;
+
+require 't/testutils.pl';
+
+use Find::Lib 'mylib', 'MyLib', a => 1, b => 42;
+
+ok $MyLib::imported{'a'};
+is $MyLib::imported{'b'}, 42;

Added: branches/upstream/libfind-lib-perl/current/t/05-complex.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/05-complex.t?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/05-complex.t (added)
+++ branches/upstream/libfind-lib-perl/current/t/05-complex.t Sat Jul  4 00:37:17 2009
@@ -1,0 +1,12 @@
+use strict;
+use Test::More tests => 3;
+
+require 't/testutils.pl';
+
+use Find::Lib libs => [ '../unexistent', 'mylib' ],
+              pkgs => { MyLib => [ a => 1, b => 42+42 ],
+                        'Test::More' => [],
+                      };
+
+ok $MyLib::imported{'a'};
+is $MyLib::imported{'b'}, 84;

Added: branches/upstream/libfind-lib-perl/current/t/06-empty.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/06-empty.t?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/06-empty.t (added)
+++ branches/upstream/libfind-lib-perl/current/t/06-empty.t Sat Jul  4 00:37:17 2009
@@ -1,0 +1,9 @@
+use strict;
+use Test::More tests => 2;
+
+require 't/testutils.pl';
+
+use Find::Lib 'libs';
+
+ok "compiled...";
+in_inc( 'libs' );

Added: branches/upstream/libfind-lib-perl/current/t/07-libs.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/07-libs.t?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/07-libs.t (added)
+++ branches/upstream/libfind-lib-perl/current/t/07-libs.t Sat Jul  4 00:37:17 2009
@@ -1,0 +1,7 @@
+use strict;
+use Test::More tests => 2;
+
+require 't/testutils.pl';
+
+use Find::Lib 'libs', 'Foo', a => 1, b => 42;
+in_inc( 'libs' );

Added: branches/upstream/libfind-lib-perl/current/t/08-dupe-slashes.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/08-dupe-slashes.t?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/08-dupe-slashes.t (added)
+++ branches/upstream/libfind-lib-perl/current/t/08-dupe-slashes.t Sat Jul  4 00:37:17 2009
@@ -1,0 +1,7 @@
+use strict;
+use Test::More tests => 2;
+
+require 't/testutils.pl';
+
+use Find::Lib './///libs', 'Foo', a => 1, b => 42;
+in_inc( 'libs' );

Added: branches/upstream/libfind-lib-perl/current/t/libs/Foo.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/libs/Foo.pm?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/libs/Foo.pm (added)
+++ branches/upstream/libfind-lib-perl/current/t/libs/Foo.pm Sat Jul  4 00:37:17 2009
@@ -1,0 +1,5 @@
+package Foo;
+
+use Test::More;
+ok 1, __PACKAGE__ . " loaded";
+1;

Added: branches/upstream/libfind-lib-perl/current/t/moretests/01-relative.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/moretests/01-relative.t?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/moretests/01-relative.t (added)
+++ branches/upstream/libfind-lib-perl/current/t/moretests/01-relative.t Sat Jul  4 00:37:17 2009
@@ -1,0 +1,10 @@
+use strict;
+use Test::More tests => 3;
+
+use Find::Lib libs => [ '../mylib', 'mytestlib' ],
+              pkgs => { MyLib => [ a => 1, b => 42+42 ],
+                        'Test::More' => [],
+                      };
+
+ok $MyLib::imported{'a'};
+is $MyLib::imported{'b'}, 84;

Added: branches/upstream/libfind-lib-perl/current/t/moretests/02-dollar0-begin.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/moretests/02-dollar0-begin.t?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/moretests/02-dollar0-begin.t (added)
+++ branches/upstream/libfind-lib-perl/current/t/moretests/02-dollar0-begin.t Sat Jul  4 00:37:17 2009
@@ -1,0 +1,13 @@
+use strict;
+use Test::More tests => 1;
+
+# this screws everything :/
+BEGIN { $0 = "[ren/am/med]" };
+
+use Find::Lib;
+eval {
+    Find::Lib->import('../mylib', 'MyLib', a => 1, b => 42);
+};
+chomp $@;
+ok $@, "we die if \$0 ($0) doesn't make sense";
+diag "ERROR was: $@";

Added: branches/upstream/libfind-lib-perl/current/t/moretests/02-dollar0.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/moretests/02-dollar0.t?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/moretests/02-dollar0.t (added)
+++ branches/upstream/libfind-lib-perl/current/t/moretests/02-dollar0.t Sat Jul  4 00:37:17 2009
@@ -1,0 +1,12 @@
+use strict;
+use Test::More tests => 3;
+
+$0 = "Renammed";
+use Find::Lib '../mylib', 'MyLib', a => 1, b => 42;
+
+ok $MyLib::imported{'a'};
+is $MyLib::imported{'b'}, 42;
+
+## would that BEGIN moved up before the 'use'
+## it would break Find::Lib, see the other test
+BEGIN { $0 = "Renammed"; }

Added: branches/upstream/libfind-lib-perl/current/t/moretests/03-chdir-begin.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/moretests/03-chdir-begin.t?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/moretests/03-chdir-begin.t (added)
+++ branches/upstream/libfind-lib-perl/current/t/moretests/03-chdir-begin.t Sat Jul  4 00:37:17 2009
@@ -1,0 +1,12 @@
+use strict;
+use Test::More tests => 2;
+
+use Find::Lib;
+
+BEGIN { chdir '/tmp' };
+
+eval { 
+    Find::Lib->import('../mylib', 'MyLib', a => 1, b => 42);
+};
+ok ! $@, "we didn't die, because initial Find::Lib compilation saved cwd";
+

Added: branches/upstream/libfind-lib-perl/current/t/moretests/03-chdir-topbegin.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/moretests/03-chdir-topbegin.t?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/moretests/03-chdir-topbegin.t (added)
+++ branches/upstream/libfind-lib-perl/current/t/moretests/03-chdir-topbegin.t Sat Jul  4 00:37:17 2009
@@ -1,0 +1,11 @@
+use strict;
+use Test::More tests => 2;
+
+BEGIN { chdir '/tmp' };
+
+use Find::Lib;
+
+eval {
+    Find::Lib->import('../mylib', 'MyLib', a => 1, b => 42);
+};
+ok !$@, "we didn't die because chdir doesn't change PWD, so we are safe";

Added: branches/upstream/libfind-lib-perl/current/t/moretests/03-chdir.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/moretests/03-chdir.t?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/moretests/03-chdir.t (added)
+++ branches/upstream/libfind-lib-perl/current/t/moretests/03-chdir.t Sat Jul  4 00:37:17 2009
@@ -1,0 +1,11 @@
+use strict;
+use Test::More tests => 3;
+
+chdir "/";
+
+use Find::Lib '../mylib', 'MyLib', a => 1, b => 42;
+
+ok $MyLib::imported{'a'};
+is $MyLib::imported{'b'}, 42;
+
+BEGIN { chdir '/tmp' };

Added: branches/upstream/libfind-lib-perl/current/t/moretests/03-pwd-begin.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/moretests/03-pwd-begin.t?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/moretests/03-pwd-begin.t (added)
+++ branches/upstream/libfind-lib-perl/current/t/moretests/03-pwd-begin.t Sat Jul  4 00:37:17 2009
@@ -1,0 +1,17 @@
+use strict;
+use Test::More;
+
+BEGIN {
+    if ($^O eq 'MSWin32' or $^O eq 'os2') {
+        plan skip_all => "irrelevant on dosish OS";
+    }
+    $ENV{PWD} = '/tmp'; chdir '/tmp';
+};
+plan tests => 1;
+
+use Find::Lib;
+
+eval {
+    Find::Lib->import('../mylib', 'MyLib', a => 1, b => 42);
+};
+ok $@, "we die because chdir and PWD are changed";

Added: branches/upstream/libfind-lib-perl/current/t/moretests/04-symlinks.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/moretests/04-symlinks.t?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/moretests/04-symlinks.t (added)
+++ branches/upstream/libfind-lib-perl/current/t/moretests/04-symlinks.t Sat Jul  4 00:37:17 2009
@@ -1,0 +1,54 @@
+use strict;
+use Test::More;
+use File::Copy;
+use File::Spec;
+
+our $PWD;
+our @dirs = ("testdir_$$", "testdir");
+our $link = "symlink_$$";
+my $script = 'symlink_test.pl';
+my $dirs = File::Spec->catdir(@dirs);
+my $srcfile = File::Spec->catfile('t', 'moretests', $script);
+my $dstfile = File::Spec->catfile(@dirs, $script);
+
+BEGIN {
+    $PWD = $ENV{PWD};
+    if ($^O eq 'MSWin32' or $^O eq 'os2') {
+        plan skip_all => "irrelevant on dosish OS";
+    }
+    unless (eval { symlink(".", "symlinktest$$") } ) {
+        plan 'skip_all' => "symlink support is missing on this FS";
+    }
+}
+plan tests => 2;
+
+END {
+    chdir $PWD; ## restore original directory
+    unlink "symlinktest$$";
+    unlink $link;
+    unlink $dstfile;
+    rmdir $dirs;
+    rmdir $dirs[0];
+}
+
+## let's create some stuff
+mkdir $dirs[0];
+mkdir $dirs;
+symlink $dirs, $link
+    or die "Couldn't symlink the test directory '$dirs $link': $!";
+
+copy $srcfile, $dstfile;
+
+## this is where we do the real test;
+{
+    ## Go into the symlinked directory
+    chdir $link or die "coudn't chdir to $link";
+    ## damn chdir doesn't update PWD unless comming from non-core Cwd
+    local $ENV{PWD} = File::Spec->catdir( $ENV{PWD}, $link );
+    ## execute from there, if all is ok, succeeds
+    my $ret = system 'perl', $script;
+    ok !$ret, "our script worked, meaning that compilation with symlink worked";
+
+    $ret = system 'perl', ".///$script";
+    ok !$ret, "crufty path doesn't make it blow up";
+}

Added: branches/upstream/libfind-lib-perl/current/t/moretests/mytestlib/MyLib.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/moretests/mytestlib/MyLib.pm?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/moretests/mytestlib/MyLib.pm (added)
+++ branches/upstream/libfind-lib-perl/current/t/moretests/mytestlib/MyLib.pm Sat Jul  4 00:37:17 2009
@@ -1,0 +1,9 @@
+package MyLib;
+
+use Test::More;
+
+sub import {
+    ok 0, "Shouldn't be imported because another path should take precedence";
+}
+
+1;

Added: branches/upstream/libfind-lib-perl/current/t/moretests/symlink_test.pl
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/moretests/symlink_test.pl?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/moretests/symlink_test.pl (added)
+++ branches/upstream/libfind-lib-perl/current/t/moretests/symlink_test.pl Sat Jul  4 00:37:17 2009
@@ -1,0 +1,6 @@
+#!perl
+## this is not a test in itself, don't execute
+## this is a script that is executed by a test
+
+use Find::Lib '../t/mylib', 'MyLibNoTest';
+exit 0;

Added: branches/upstream/libfind-lib-perl/current/t/mylib/MyLib.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/mylib/MyLib.pm?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/mylib/MyLib.pm (added)
+++ branches/upstream/libfind-lib-perl/current/t/mylib/MyLib.pm Sat Jul  4 00:37:17 2009
@@ -1,0 +1,14 @@
+package MyLib;
+
+use Test::More;
+
+use vars '%imported';
+
+sub import {
+    my $class = shift;
+    %imported = @_;
+}
+
+ok 1, __PACKAGE__ . " loaded";
+
+1;

Added: branches/upstream/libfind-lib-perl/current/t/mylib/MyLibNoTest.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/mylib/MyLibNoTest.pm?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/mylib/MyLibNoTest.pm (added)
+++ branches/upstream/libfind-lib-perl/current/t/mylib/MyLibNoTest.pm Sat Jul  4 00:37:17 2009
@@ -1,0 +1,10 @@
+package MyLibNoTest;
+
+use vars '%imported';
+
+sub import {
+    my $class = shift;
+    %imported = @_;
+}
+
+1;

Added: branches/upstream/libfind-lib-perl/current/t/testutils.pl
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/testutils.pl?rev=39294&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/testutils.pl (added)
+++ branches/upstream/libfind-lib-perl/current/t/testutils.pl Sat Jul  4 00:37:17 2009
@@ -1,0 +1,17 @@
+use strict;
+
+sub _in_inc {
+    my $path = shift;
+    my @match = grep { m/$path/ } @INC; 
+    return scalar @match;
+}
+
+sub in_inc {
+    ok _in_inc(@_), "$_[0] is in inc";
+}
+
+sub not_in_inc {
+    ok ! _in_inc(@_), "$_[0] is NOT in inc";
+}
+
+1;




More information about the Pkg-perl-cvs-commits mailing list