Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re: perl cant find it anymore!

by ariels (Curate)
on Jun 18, 2001 at 15:42 UTC ( [id://89337]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: perl cant find it anymore!
in thread perl cant find it anymore!

You need to change @INC in a BEGIN block in order for it to affect use commands, since they take effect at BEGIN-time. But Octavian is using require 'timelocal.pl';, which takes place at run time (Octavian: you seem to be using some old code with some old syntax; are you sure there isn't something newer that might be easier to use?). So Beatnik's change of @INC at run time is enough, as long as it takes place before the require.

Yet More Ways of setting @INC before your script starts running (and thus in time to affect both use and require):

  1. Add them to your shebang line:
    #!/path/to/perl -w -I/opt/perl5/lib/5.6.1
  2. use lib:
    use lib qw(/opt/perl5/lib/5.6.1);
    (this also works in a module, of course)
Use either, not both!

Either is preferable to manipulating @INC directly: it's clearer, and you get nicer behaviour simpler (e.g. beatnik's and Azatoth's code above adds the new directory as the last directory to be searched; you'd usually want to search it first).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://89337]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.