in reply to Net::FTP and the warn function
And you don't feel like dying, you just want to say 'Hey, this thang ain't workin'.my $ftp = Net::FTP->new( ... ) or die $!;
Well, here's one solution:
or, another way to do it might be to create a SIG handler... although I'm not fond of it personally:my $ftp = Net::FTP->new( ... ); if ( defined $ftp ) { $ftp->func1( ... ); $ftp->func2( ... ); $ftp->quit; } else { warn "Hey, this thang ain't workin! $!\n"; }
That's kinda gracefull, but it will quit your process... another solution could be:$SIG{__DIE__} = sub { warn shift and exit }; my $ftp = Net::FTP->new( ... ) or die $!;
I hope I've helped you out.sub ftp_stuff { my $ftp_ref = shift; $ftp_ref->func( ... ); $ftp_ref->quit; } my $ftp = Net::FTP->new ? ftp_stuff $ftp : warn $!;
Enjoy!
-- Casey
|
|---|