muad33b has asked for the wisdom of the Perl Monks concerning the following question:
However, the following works just fine:Use Net:SSH2; <snip> $ssh2 = Net::SSH2->new(); <snip> $ssh2->connect($host,$port); <snip> $ssh2->auth_password($os_user,$os_pass); <snip> eval { local $SIG{ALRM} = sub { die "alarm\n"; }; alarm (10); $ssh2->scp_get($remote, $local); alarm (0); };
I've googled around and seen some reference to a change in perl's eval handling in 5.8.x, as well as some reference to eval failing to timeout blocks of code involving network copys, etc... Any ideas what I have to do to get eval to do it's job here, and time out? Thanks...eval { local $SIG{ALRM} = sub { die "alarm\n"; }; alarm (10); $buf = <>; alarm (0); }; print "Timed out.\n" if ($@);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: eval problem
by ikegami (Patriarch) on Jan 09, 2007 at 07:39 UTC | |
|
Re: eval problem
by diotalevi (Canon) on Jan 09, 2007 at 07:17 UTC | |
|
Re: eval problem
by ysth (Canon) on Jan 09, 2007 at 07:58 UTC | |
by muad33b (Acolyte) on Jan 10, 2007 at 16:11 UTC | |
by BrowserUk (Patriarch) on Jan 10, 2007 at 16:23 UTC | |
by muad33b (Acolyte) on Jan 10, 2007 at 16:42 UTC | |
by muad33b (Acolyte) on Jan 16, 2007 at 22:05 UTC |