[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] confusing error message



On Thu, Oct 05, 2000 at 01:50:40AM -0400, Scott R. Godin wrote:
> # Can't call method "login" without a package or object reference.
> File 'Primus 8.5GB:Applications:MacPerl Ÿ:NaliCity:ratings:getviaftp.pl';
> Line 12
> script follows:
> 
> VERY confusing error message considering that the only problem is that I'm
> not yet connected to the internet (cuz I forgot ;) via Remote Access
> 
> -=-
> #!perl
> 
> # Mac::Types.pm complains if I use -w here. *blink* (known issue!)
> # this needs fixing by the MacPerl crew, cuz I can't figure it out. :-\
> 
> use strict;
> #declare my sub in advance so I can group 'em at the bottom.
> sub round;
> my @data = ( 'utassault', 'utdm', 'utdomination', 'utctf', 'utother'); #
> 
> use Net::FTP;
> my $ftp = Net::FTP->new("ftp.mysite.com");
> 
> #error generated at this line -->
> $ftp->login("username", 'password') or die ("Could not log in! $!");
> -=-

Why is that confusing?  You're not connected to the Internet, so
Net::FTP->new() returned undef, but you didn't check for that and attempted
to call $ftp->login() anyway.

Ronald

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org