[sf-perl] use lib: order doesn't seem to matter

Garth Webb garth.webb at gmail.com
Tue Aug 24 11:01:13 PDT 2010


Combing those into a single statement that has the order you want:

use lib qw( /path/b /path/a /path/c );

On Tue, Aug 24, 2010 at 10:53 AM, David Alban <extasia at extasia.org> wrote:

> greetings,
>
> one of our customary 'use lib' statements for a local program is:
>
>  use lib '/nas/reg/lib/perl';
>
> i'm modifying the program and in my development area, i want to use a
> locally modified version of one of the modules it uses.
>
> but it's picking up the installed module rather than my local module.
>
> here's what i'm seeing:
>
>  DB<1> l 1+10
> 1       #!/usr/bin/perl
> 2
> 3:      use strict;
> 4:      use warnings;
> 5
> 6:      use lib '/nas/reg/lib/perl';
> 7
> 8            ##### => dbg
> 9:      use lib
>
> '/nas/home/dalban/perforce/srwd00reg001/default/internal/reg/pb_reg_nasify_properties/lib/perl';
> 10           ##### <= dbg
> 11
>  DB<2> x @INC
> 0  '/nas/reg/lib/perl/x86_64-linux-thread-multi'
> 1  '/nas/reg/lib/perl/5.8.5'
> 2  '/nas/reg/lib/perl'
> 3
>  '/nas/home/dalban/perforce/srwd00reg001/default/internal/reg/pb_reg_nasify_properties/lib/perl'
>
> and if i reverse the order in which i "use" them, i get:
>
>  DB<1> l 1+10
> 1       #!/usr/bin/perl
> 2
> 3:      use strict;
> 4:      use warnings;
> 5
> 6            ##### => dbg
> 7:      use lib
>
> '/nas/home/dalban/perforce/srwd00reg001/default/internal/reg/pb_reg_nasify_properties/lib/perl';
> 8            ##### <= dbg
> 9
> 10:     use lib '/nas/reg/lib/perl';
> 11
>  DB<2> x @INC
> 0  '/nas/reg/lib/perl/x86_64-linux-thread-multi'
> 1  '/nas/reg/lib/perl/5.8.5'
> 2  '/nas/reg/lib/perl'
> 3
>  '/nas/home/dalban/perforce/srwd00reg001/default/internal/reg/pb_reg_nasify_properties/lib/perl'
>
> i thought 'use lib' had the effect of unshifting its arg onto @INC,
> but /nas/reg/lib/perl seems to "win" no matter in what order i specify
> the libs.
>
> i've done this before with no problem.  i'm sure i'm missing
> something.  or perhaps it only seemed to work before...
>
> what am i missing?
>
> thanks,
> david
> --
> Live in a world of your own, but always welcome visitors.
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20100824/dfd3bf02/attachment.html>


More information about the SanFrancisco-pm mailing list