CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
The Unsupported function alarm function

 



Bode
Novice

Nov 25, 2002, 8:41 AM

Post #1 of 5 (1274 views)
The Unsupported function alarm function Can't Post

I get this error

"The Unsupported function alarm function is unimplemented at D:/Perl/lib/Net/Ping
.pm line 308."

when trying to run the following prgram

use Net::Ping;


$p = Net::Ping->new("tcp");


$host = 'seciu.edu.uy';
print "$host is alive." if $p->ping($host);


$host = '10.10.10.10'; # Dead IP.
print "$host is alive." if $p->ping($host);


$host = '164.73.128.5';
print "$host is alive." if $p->ping($host);


$p->close();

I looked at the module ping.pm and located the line in the error statement.

$SIG{'ALRM'} = sub { die };
alarm($timeout); # Interrupt connect() if we have to



I have not got a clue what to do!! Any help would be much appreaciated.



Cheers ALL


mhx
Enthusiast / Moderator

Nov 26, 2002, 12:27 AM

Post #2 of 5 (1264 views)
Re: [Bode] The Unsupported function alarm function [In reply to] Can't Post

As I can see from the output, you're using Perl on Windows. Let me also guess that you're using either perl 5.6.1 or perl 5.6.0, or even an older perl.

The problem is that these perl binaries don't have an alarm() function. The alarm() function is specific to UNIX systems, there's no such thing on Windows, which is why is wasn't implemented.

However, with perl 5.8.0, alarm() is also supported on Windows. So, the best thing would be for you to upgrade to 5.8.0...

There's a [url=http://www.activestate.com/Products/Download/Download.plex?id=ActivePerl&type=Beta]binary available from ActiveState, although it's still in Beta state. But you can also compile it directly from the [url=ftp://ftp.cpan.org/CPAN/src/perl-5.8.0.zip]source, which isn't a big deal.

Hope this helps,

-- mhx

At last with an effort he spoke, and wondered to hear his own words, as if some other will was using his small voice. "I will take the Ring," he said, "though I do not know the way."

-- Frodo



Bode
Novice

Nov 27, 2002, 5:05 AM

Post #3 of 5 (1255 views)
Re: [mhx] The Unsupported function alarm function [In reply to] Can't Post

Cheers. I have installed the latest version of perl on my machine and the program works fine which is really cool.



However if I cant get them to upgrade the version of perl that is on the webserver is there any other way I can get round this ?



Cheers for any help.


Paul
Enthusiast

Nov 27, 2002, 7:28 AM

Post #4 of 5 (1251 views)
Re: [Bode] The Unsupported function alarm function [In reply to] Can't Post

I've encountered errors with Net::SMTP on windows regarding getpwuid and I fixed that by requiring the module instead of using it - maybe that will fix it...eg...


Code
local ($SIG{__DIE__}, $^W); 
eval {
require Net::Ping;
};



Bode
Novice

Nov 29, 2002, 2:46 AM

Post #5 of 5 (1241 views)
Re: [RedRum] The Unsupported function alarm function [In reply to] Can't Post

Sussed a way of doing it in windows,



$alive = 0;
foreach (`ping -n 1 $host`) {
if ($_ =~ m/^Reply from /) {
$alive = 1;
}
}


if ($alive) {
print "machine is alive";
} else {
print "machine is dead";
}




Crazy Cheers!

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives