Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Net:Telnet errmode coderef

Status
Not open for further replies.

dod123

Programmer
Dec 13, 2004
20
IL
Hello all;

I am using the Net:telnet module. I want to write a ermode diffrent than DIE.
I'm aware of the errmode & coderef posibilities in the module but I have no idea how two use them.

Thanks a lot for any assitance.
 
Here we go:

Making connection to yahoo..It works..Now if you change to an unexisting web page it fails and goes to the error routine.

#!/usr/bin/perl
use Net::Telnet;
$connection=Net::Telnet->new(Timeout => 5, Host => " Port=>80, errmode =>sub {&error});

sub error {
print "Connection Failed!\n";
}

__________________________________________________________
Other:

#!/usr/bin/perl
use Net::Telnet;
$connection=Net::Telnet->new(Timeout => 5, Host => " Port=>80);

# This error handler prints the errmsg and continues.
$connection->errmode( sub { print @_, "\n" } );

----------------------------------------------------------

Other

telnet = new Net::Telnet;
$telnet->errmode( sub { print "ERROR:" . join('|', @_) . "\n"; } );




dmazzini
GSM System and Telecomm Consultant
 
Thanks a lot,

Its exactlly what I looked for.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top