Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Can't locate object method

by RachunZero (Novice)
on Feb 01, 2011 at 17:01 UTC ( #885557=perlquestion: print w/replies, xml ) Need Help??
RachunZero has asked for the wisdom of the Perl Monks concerning the following question:

I'm a lowly web site admin rather than a real programmer, and I've built a nice shiny new Apache 2.0.64, perl 5.12.2, and mod_perl build for my developer friend, but some of his code doesn't run. I get "Can't locate object method "new" via package "LWP::Protocol::https::Socket" at ../../../cgi/".

If I troll through the code, it certainly looks like there's a "new"

This used to work in my last build, but I'm a but stuck now. I'm not even sure how to start resolving this issue. I don't expect someone to debug my program for me, but is there somewhere that I can start reading that would explain how I can resolve such dependency issues?

(bows respectfully)



Maybe this will reveal my mistake:

Modules originally installed in order using cpan, then the cpan directory is tarballed and I traverse the module directories doing a

$PERL_DIR/bin/perl Makefile.PL PREFIX=$PERL_DIR -n make clean $PERL_DIR/bin/perl Makefile.PL PREFIX=$PERL_DIR -n make make test make install

with the exception of the SSLeay modules which require me to specify the openssl path

Replies are listed 'Best First'.
Re: Can't locate object method
by biohisham (Priest) on Feb 01, 2011 at 17:17 UTC
      I think that I have those modules installed, but it could be some sort of inappropriate use of recreational drugs that makes me think so. I suspect that I've done something wrong in terms of setting up the environment or installing them. I think that's what I really need your help on. I need to know how to "verify" that something is installed as I think it is and how to check my environment to be sure that the modules are visibile to the code that is using them.
        I need to know how to "verify" that something is installed

        Try to load the modules from the command line  (only one of them needs to work):

        $ perl -MNet::SSL -e1 or $ perl -MIO::Socket::SSL -e1

        and see what error messages you get (if any).  Things should be fine if you don't get an error message.

        (Be sure to use the same Perl version and environment that is being used by Apache.)

Re: Can't locate object method
by Anonyrnous Monk (Hermit) on Feb 01, 2011 at 17:36 UTC

    LWP::Protocol::https::Socket inherits (the "new" method) from Net::HTTPS, which in turn inherits from one of the SSL implementations Net::SSL / Crypt::SSLeay or IO::Socket::SSL.

    In other words, you probably have neither of those latter modules - with their respective dependent shared libs (OpenSSL/SSLeay) - installed properly.

      Thanks for the details :-)

      I think you're right. I think I need to know more about how the shared libraries are installed and referenced. Is there some documentation that explains this?

      I understand that when I install a module that I get some perl code and some compiled code, but I'm not sure how this works, where it ends up, and how to make sure it's in the right place.

        It would be easier to help if we knew, for example, what platform you're on, what modules (you think) you have installed, how exactly you installed them, whether there were any errors at build/install time, etc.

        In general, for tracking down problems with dependent libs, ldd is your friend (assuming you're on Linux/Unix — though there are similar tools for Windows).  For example, if you have Crypt::SSLeay installed, find Crypt/SSLeay/, and run ldd on it. It should list what other shared libraries depends on, and whether (and from where) those other libraries (such as would be loaded.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://885557]
Approved by biohisham
Front-paged by biohisham
and a moth chases the moon...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2018-03-24 20:11 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (299 votes). Check out past polls.