Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I get the error : Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/Mail/POP3Client.pm line 422 when calling the Connect() And the Connect Sub:
sub Connect { my ($me, $host, $port) = @_; $host and $me->Host($host); $port and $me->Port($port); my $s = $me->{SOCK}; if (defined fileno $s) { # close and reopen... $me->Close; } socket($s, PF_INET, SOCK_STREAM, getprotobyname("tcp") || 6) or $me->Message("could not open socket: $!") and return 0; connect($s, pack($sockaddr, AF_INET, $me->{PORT}, $me->{ADDR}) ) or $me->Message("could not connect socket [$me->{HOST}, $me->{POR +T}]: $!") and return 0; select((select($s) , $| = 1)[0]); # autoflush defined($msg = <$s>) or $me->Message("Could not read") and return +0; chop $msg; $me->Message($msg); $me->State('AUTHORIZATION'); $me->User and $me->Pass and $me->Login; } # end Connect
This is from the newest of POP3Client v 5.8.0 HELP, obviouisly this is just a connection issue

Replies are listed 'Best First'.
Re: Mail::POP3Client Connection
by BrowserUk (Patriarch) on Jul 08, 2003 at 19:08 UTC

    The code you've posted is presumably from which ever version of Mail::POP3Client.pm you have installed. There are 3 problems with this.

    1. You don't indicate which line of the code you posted is line 422 from the error message.
    2. You don't say which version of the module you have installed

      A quick look at CPAN turns up two versions, 2.13 & 2.14. The problem is that line 422 in both of these does not fall within the scope of the code you posted. In one version it is a blank line just below the Login() sub, in the other it falls part way through the Login() sub, but in neither case does the line look like it could produce the error message you are getting.

    3. Showing us the code producing the error messsage, even if you did indicate which line it was, without showing us the code that is calling the sub, and the values of the parameters you are passing when you call it, means we stand no chance of helping you.

    As a quick debug, I recommend that you add a line

    warn join'|', @_, $/;
    as the very first line inside the Connect() sub, and see what values you are actually passing in. A pound to a penny, that one or more of the parameters you are passing is undef. If this is the case, you will see two adjacent vertical bars, ("...||...") somewhere in the output produced by the line above. HTH.
    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller


Re: Mail::POP3Client Connection
by Thelonius (Priest) on Jul 08, 2003 at 19:57 UTC
    I'm going to guess that you are not setting the HOST parameter correctly, but as BrowserUk says, without your code ...