Skip Menu |

This queue is for tickets about the libnet CPAN distribution.

Report information
The Basics
Id: 97934
Status: open
Priority: 0/
Queue: libnet

People
Owner: Nobody in particular
Requestors: BGU [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.27
Fixed in: (no value)



Subject: constructor does not set $@
my $ftp = Net::FTP->new( $ftp_server, Debug => 0 ) or die "$@"; Use of uninitialized value $@ in concatenation (.) or string Net::FTP->new does not set $@ as the documentation mentions, but sets @! instead
On 2014-08-11 08:42:46, BGU wrote: Show quoted text
> my $ftp = Net::FTP->new( $ftp_server, Debug => 0 ) or die "$@"; > > Use of uninitialized value $@ in concatenation (.) or string > > Net::FTP->new does not set $@ as the documentation mentions, but sets > @! instead
It sounds pretty odd to me that a constructor would do anything other than return a blessed object or die. That's not very perlish!
On Mon Aug 11 11:42:46 2014, BGU wrote: Show quoted text
> my $ftp = Net::FTP->new( $ftp_server, Debug => 0 ) or die "$@"; > > Use of uninitialized value $@ in concatenation (.) or string > > Net::FTP->new does not set $@ as the documentation mentions, but sets > @! instead
Can you give an example of this? Looking at the code, it mostly does what it says on the tin, namely, return undef and put an error message in $@ (however un-perlish that may be!). In some cases it does actually croak() instead! E.g. Non-existent host: Show quoted text
>perl -MNet::FTP -le "$f = Net::FTP->new('XXX') or print 'Error: ' . $@"
Error: Net::FTP: Bad hostname 'XXX' or localhost with no FTP server: Show quoted text
>perl -MNet::FTP -le "$f = Net::FTP->new('localhost') or print 'Error: ' . $@"
Error: Net::FTP: connect: 10061