Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Adding directories to the end of @INC

by mykl (Monk)
on Jul 01, 2011 at 10:33 UTC ( [id://912325]=note: print w/replies, xml ) Need Help??


in reply to Adding directories to the end of @INC

lib.pm isn't very large or complicated - how about making a copy with a new name (lib::append, maybe?) and replacing the unshift(@INC,...)s with pushes? And perhaps add a couple of reverses if you want duplicate-removal to leave the last instance of a directory instead of the first:

# remove trailing duplicates ## @INC = grep { ++$names{$_} == 1 } @INC; # remove leading duplicates @INC = reverse grep { ++$names{$_} == 1 } reverse @INC;

--

"Any sufficiently analyzed magic is indistinguishable from science" - Agatha Heterodyne

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2025-03-18 13:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When you first encountered Perl, which feature amazed you the most?










    Results (57 votes). Check out past polls.