Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Adding directories to the end of @INC

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

in reply to Adding directories to the end of @INC 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?

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2023-12-03 13:27 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (20 votes). Check out past polls.