Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Adding directories to the end of @INC

by Khen1950fx (Canon)
on Jul 01, 2011 at 17:35 UTC ( #912388=note: print w/replies, xml ) Need Help??


in reply to Adding directories to the end of @INC

But it's a bit cryptic...

Let's make it a little less cryptic.

#!/usr/bin/perl use strict; use warnings; use Data::Dumper::Concise; my $foo; my $bar; BEGIN { $foo = '/foo'; $bar = '/bar'; } my(@dirs) = ($foo, $bar); use lib @dirs; push @INC, @dirs; print Dumper(@dirs), "\n", join("", @INC), "\n"; no lib @dirs; exit;
Update: Used lib::tiny and made a few changes.
#!/usr/bin/perl use strict; use warnings; use Data::Dumper::Concise; my $foo; my $bar; BEGIN { $foo = '/foo'; $bar = '/bar'; } my @dirs = ($foo, $bar); use lib::tiny @dirs; push @INC, @dirs; foreach my $dir(@dirs) { print Dumper(join("", @INC)), Dumper($dir), "\n"; } no lib::tiny @dirs; exit;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://912388]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2023-12-03 15:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (20 votes). Check out past polls.

    Notices?