in reply to Undef on POP3 method

It would appear that this line:
$pop3 = Net::POP3->new('$host');
is failing. I would suspect the '$host' part. You are passing to new() a string containing $host, not the value of $host. Since $host is not specifically defined in your login() subroutine, it must be a global to have any value there.

I have not used POP3, but I suspect that $host is not what it expects. Try removing the single-quotes (which do not interpolate the value of any variables in them), or (yuck!) replacing them with double-quotes and see if it works correctly.

Russ
Brainbench 'Most Valuable Professional' for Perl

Replies are listed 'Best First'.
RE: RE: Undef on POP3 method
by elusion (Curate) on Jul 31, 2000 at 04:50 UTC
    Ahhah! it worked. Thanx a bundle. I guess I was thinkin' to hard. Well, either that or I don't know what I'm doing. ;)

    - p u n k k i d
    "Reality is merely an illusion, albeit a very persistent one."
    -Albert Einstein

      Quick and dirty explanation of interpolation for ya:

      my $this = 'hello'; my $thisvar = 'goodbye'; # prints 'hello' of course print $this; # single quotes mean no interpolation occurs, prints '$this' print '$this'; # double quotes invoke interpolation, prints 'hello' print "$this"; # perl does 'greedy' interpolation (don't know if that's the # right term) so this prints 'goodbye' print "$thisvar"; # this makes it explicit that we only want $this, so this # line prints 'hellovar' print "${this}var";
      I'm sure the faq has a more detailed explanation that covers list interpolation as well...

      -Mark

      You're certainly welcome. We all fall victim to this kind of error. If you are old (currently interpreted by Russ as > 31), you could just call this a "mature moment." :-)

      Of course, by my metric, I will never get to say that about any of my sillinesses...

      Russ
      Brainbench 'Most Valuable Professional' for Perl

        Well actually I'm only 14... so I guess that's not old. I'll just consider this as a warning of things to come. ;)

        - p u n k k i d
        "Reality is merely an illusion, albeit a very persistent one." -Albert Einstein