in reply to Error "undefined value as a symbol reference "

You aren't checking (and taking appropriate action) whether IO::Socket::INET->new returns a true value. Creation of sockets might fail.
  • Comment on Re: Error "undefined value as a symbol reference "

Replies are listed 'Best First'.
Re^2: Error "undefined value as a symbol reference "
by Anonymous Monk on Apr 22, 2005 at 10:44 UTC
    What should be corrected? (it's http-proxy script, I'd used ready code, I am not a very familiar in perl)

      When you open your socket, you can do something else if it didn't open. For instance, if you wanted the program to end immediately:

      my $server = IO::Socket::INET->new ( LocalPort => 8080, Type => SOCK_STREAM, Reuse => 1, Listen => 10) or die ("Can't open socket : $!");

      It's a good idea to check anything that has a potential to fail. (opening files, closing files that you've written to, opening database connections, etc.)

        After an implementing this correction, got a new error:
        Software error:
        Can't open socket: Address already in use at /home/www/myspace.superihost.com/cgi-bin/script.pl line 10.