Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Perl module installing at server

by sundialsvc4 (Abbot)
on Aug 19, 2013 at 12:51 UTC ( #1050026=note: print w/replies, xml ) Need Help??

in reply to Perl module installing at server

This error-message is not saying that it can’t find Perl, nor anything about whether-or-not there is more than one Perl interpreter.   It is saying that you have somewhere tried to use String; but cannot be found in any of the places which Perl knows to look for it ... the so-called @INC list (see perlfaq8 and other such places).

The “path to Perl” setting won’t be useful.   What you need to specify is the include-path; the so-called PERL5LIB environment-variable content.

But first ... my Spidey Sense™ is going-off here.   You said that you are just using a vendor-supplied control panel.   Apparently, String is not a pre-installed module at your hosting company ... did you intend to install it; do you know how, if you did not?   I ask this simply for clarification.   Tell us more about where you’re coming from, and we can then more specifically help you.

No, upon re-reading, I see that you did install the modules.   Let’s presume for simplicity that it worked.   In this case, you can either arrange by some means to define the PERL5LIB environment variable, or, as I prefer to do, write a short “stub” script which issues a use lib statement and then invokes the “real” main-program.   This causes the known-good search path to be added to the front of @INC so that the modules can subsequently be found.

use lib whatever... ; real_main_program();

Replies are listed 'Best First'.
Re^2: Perl module installing at server
by chromatic (Archbishop) on Aug 19, 2013 at 17:52 UTC
    ... as I prefer to do, write a short “stub” script which issues a use lib statement and then invokes the “real” main-program.

    I'm not sure this advice is helpful at all. In truth, I think your choice of words is prone to confuse more than illuminate. The OP clearly knows how to use use; why imply wrapping a program in another program with the terms "stub" and "invoke" and "real"?

      Your point is well taken.   What I mean to say is that (especially in a shared-hosting situation) it is often convenient to execute a very-short program whose sole purpose is to execute a use lib statement (to push paths onto @INC), then call the original main-program.   The other way to do it is to somehow ensure a correct value for PERL5LIB but I tend to like this way better.

      It has also been a real bone of contention for me that lots of hosting-services pay a great deal attention to PHP but run truly-antique versions of Perl ... and also place sometimes-too-severe resource limit restrictions.   You have to shop carefully.

        I don't think you took my point at all.

        The OP showed code in which the OP already used pragmas and modules in the main program. What possible value is there to the OP in writing yet another program which will somehow have to do or require or use that main program, just to avoid writing a single use lib '...' statement in the main program which the OP has already written and already demonstrated comfort with and competence in using, well, use?

        Worse than that convolution, your suggestion is still misleading. What does "call the original main-program" mean? Use system? (Clearly not, because that won't work, because @INC isn't an environment variable inherited between processes.) Use do or require or use? Again, why—and how do you know what "original main-program" to call? Either you hard code its name, in which case your very short program gets a line longer for no benefit, or you make it parametric somehow by playing with $0 and symlinks (clever but not clear at all), taking input from the command line (I'm shaking my head here), or opening a security hole by taking input from untrusted clients in a CGI situation like the OP has demonstrated.

        Now you could have talked about, but in a CPanel environment, does that file even exist? Is it accessible to the OP?

        Alternately, you could have given the correct and simple and clear answer: use lib '...'; without messing around with invoking other programs at all.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1050026]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2017-05-23 06:37 GMT
Find Nodes?
    Voting Booth?