Wise monks, please help this lowly Perl hacker with an annoying problem. I am working on a email script and ran into problems. I have hacked together the following script to test if I can access a pop3 server. When run locally on my M$ XP box under cygwin it works fine, when I upload it to my hosted webserver it fails and it is beyond me as to why. The error I get is: Can't call method "login" on an undefined value at /home/xxx/xxx/TestPopMail.pl line 22. Any suggestions, the small script is listed below.
#!/usr/bin/perl -wT use CGI::Carp qw( fatalsToBrowser ); print "Content-type: text/html\n\n"; print "<html><head><title>Test Page</title></head><body>"; $| = 1; use warnings; use strict; eval( "use Net::POP3;" ); die "Module Configuration Error: $@" if $@; my $time = scalar localtime; my $pop3 = "xxx.xxx.xxx"; my $login = "xxx\@xxx.xxx"; my $pass = "xxxxxxxx"; my $pop = Net::POP3->new($pop3); #my $smtp = Net::SMTP->new($ssmtp); $res = $pop->login($login, $pass); if ($res eq "undef"){ print "Couldn't connect $!\n"; } else { print "On $time e-mail status inbox: $res post \n"; } my $i =0; print("Deleting $res mails ...\n"); for($i = 0; $i<$res; $i++) { # $pop->delete($i); } $pop->quit(); print "</html></body>";
_update/idea_ Looking at this I am wondering if I am not getting a connection to the pop3 server, and that in turn is causing the error in the login call?

Kia Kaha, Kia Toa, Kia Manawanui!
Be Strong, Be Brave, Be perservering!


In reply to Can't call method... works locally, but not on webserver. by lwicks

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.