Beefy Boxes and Bandwidth Generously Provided by pair Networks chromatic writing perl on a camel
Perl Monk, Perl Meditation
 
PerlMonks  

Re: perl cant find it anymore!

by azatoth (Curate)
on Jun 18, 2001 at 15:06 UTC ( [id://89323]=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 perl cant find it anymore!

You'll want to put beatnik's comment in a BEGIN block though, to ensure it's sorted before we start the getting to the nuts and bolts of things.

BEGIN { push(@INC,"/opt/perl5/lib/5.6.1"); } #rest of code follows


Azatoth a.k.a Captain Whiplash

Make Your Die Messages Full of Wisdom!
Get YOUR PerlMonks Stagename here!
Want to speak like a Londoner?

Replies are listed 'Best First'.
Re: Re: perl cant find it anymore!
by ariels (Curate) on Jun 18, 2001 at 15:42 UTC
    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://89323]
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.