4
votes

Can anybody throw me a bone on this one?

Can't locate object method "new" via package "IO::Socket::SSL" at Services/IMAP/Client.pm line 136.

          if ( $use_ssl ) {
135             require IO::Socket::SSL;
136             $imap = IO::Socket::SSL->new (
137                                 Proto    => "tcp",
138                                 PeerAddr => $hostname,
139                                 PeerPort => $port,
140                                 Timeout  => $timeout,
141                                 Domain   => AF_INET,
142                     )
143                     or $self->log_(0, "IO::Socket::SSL error: $@");
144         }

It has been running fine for months, but after some upgrading; presumably perl, it started.

Perl version is: (v5.16.3) on RHEL5

$perldoc -lm IO::Socket::SSL 
/usr/local/lib/perl5/site_perl/5.16.3/IO/Socket/SSL.pm 

$perldoc -lm IO::Socket::INET 
/usr/local/lib/perl5/5.16.3/i686-linux/IO/Socket/INET.pm 

$perldoc -lm Net::SSLeay 
/usr/local/lib/perl5/site_perl/5.16.3/i686-linux/Net/SSLeay.pm

Am I missing dependencies?

Any help would be greatly appreciated

 These all return without errors.
[root@gw1 ]# perl -MIO::Socket::SSL -e1
[root@gw1 ]# perl -MIO::Socket::IP -e1
[root@gw1 ]# perl -MIO::Socket::INET6 -e1
[root@gw1 ]# perl -MIO::Socket::INET -e1
[root@gw1 ]# perl -MNet::SSLeay -e1
[root@gw1 ]#
2
Any reason why you're using "require" instead of "use"? - AKHolland
Hi, no reason. I didn't write this piece of code. I'll test it. Thanks! - user2385398
With use instead of require same thing Can't locate object method "new" via package "IO::Socket::SSL" at Services/IMAP/Client.pm line 137" - user2385398

2 Answers

2
votes

IO::Socket::SSL will try to load other modules before it decides from which module to inherit. These are:

  • IO::Socket::IP
  • IO::Socket::INET6
  • IO::Socket::INET

Since you do have IO::Socket::INET installed, maybe one of the other two modules is making trouble?

1
votes

A bit embarrassing, but I found the issue causing my problems: The shebang in the files used were: #!/usr/bin/perl (Using the vendor perl)
Whereas
#!/bin/env/ perl
or
#!/usr/bin/local/perl
Is needed for my non vendor perl installed version. Adjust for platform.

To everybody who provided input, thanks!