in reply to Can't call method... works locally, but not on webserver.

You aren't checking the return value from Net::POP3->new - and that call seems to be failing. Perhaps your web server can't access the POP3 server that you're trying to connect to.

--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

  • Comment on Re: Can't call method... works locally, but not on webserver.

Replies are listed 'Best First'.
Re^2: Can't call method... works locally, but not on webserver.
by lwicks (Friar) on Nov 08, 2006 at 12:22 UTC
    Aha... following your suggestion I changed the line to:
    my $pop = Net::POP3->new($pop3) or die "Unable to connect: $!";
    Which returned: Unable to connect: Connection timed out at /home/xxx/xxx/DeletePopMail.pl line 19 Now all I have to do is work out why I can connect from my PC but not via the webserver! Thanks for the useful reply, much appreciated.
      I ran into a similar problem (CGI script unable to access the network) and discovered that it stemmed in my case from SELinux, the NSA's secured Linux kernel. It is built into Fedora from core 3 onwards, as well as some other distros, and is installed on many individual servers besides. If you determine that you are running selinux (try the command /usr/sbin/selinuxenabled (default path). If it returns 0, you have it), it has a variable called httpd_can_network_connect. Set this to 1 and selinux will stop blocking CGI network connections.
        --> discovered that it stemmed in my case from SELinux

        And thus, this is the reason that I choose to completely avoid SELinux. Know though, that during the installation of Linux ( Fedora) you have the option of enabling or not enabling SELinux. Personally, I choose not to because of the extremely restrictive nature of SELinux. Granted, if you are trying to comletely secure a machine then it might be for you, but not the average user.

        #jlk

        Every time Linux boots, a penguin gets its wings.