Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Ignoring @INC in a use

by jreades (Friar)
on Aug 13, 2001 at 03:05 UTC ( [id://104334]=perlquestion: print w/replies, xml ) Need Help??

jreades has asked for the wisdom of the Perl Monks concerning the following question:

It's been a long time since I had to write any Perl CGIs, and even longer since I wasn't root on the machine that I will be deploying the CGI on, so that has led me to this problem...

I'm working from a shopping cart SDK that requires the Net::SSLeay module to perform secure transactions with the transaction server. The SDK also requires modifications to the SSLeay module.

It may be a while since I've had to share a machine, but even I know that making changes to shared module on a co-hosted machine is a BAD THING.

So I went looking for a way to import the altered module into the CGI script and came up with:

BEGIN { push @INC, "/path/to/module"; } use SSLeay;

Where the module file name is SSLeay.pm and can be found at /path/to/module/SSLeay.pm.

Only problem is, it doesn't work -- sometimes it doesn't work and gives me the 'premature end of script headers' error, other times I got an error about Dynaloader and a version 1.05 vs. 1.08. I'm not using 1.05 AFAIK. Anywhere...

Any takers?

Replies are listed 'Best First'.
Re: Ignoring @INC in a use
by Zaxo (Archbishop) on Aug 13, 2001 at 03:10 UTC

    The line,

    use lib '/path/to/module';
    does what you want.

    If you use unshift instead of push, your way will work, too. push places the custom library at the end of the path

    After Compline,
    Zaxo

Re: Ignoring @INC in a use
by John M. Dlugosz (Monsignor) on Aug 13, 2001 at 06:04 UTC
    You added your desired path to the end of the list, not the beginning. The "other" one, the one you don't want to share, is being found first.

    push adds to right, unshift adds to left.

    —John

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-23 15:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found