Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Ignoring @INC in a use

by jreades (Friar)
on Aug 13, 2001 at 03:05 UTC ( #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 and can be found at /path/to/module/

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,

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.


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2023-02-05 23:37 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (33 votes). Check out past polls.