[Israel.pm] Why am I not printing getting results? What am I missing

Chanan Berler bc.other at gmail.com
Tue Sep 18 05:07:52 PDT 2007


try this first:

use strict;
use warnings;

use Net::Ping;

my $p = Net::Ping->new();
       return $p->ping(223.31.95.254);

check if it works....then apply the thread stuff.
Also i think the shift is misplaced...i think you should use the $_
in the subroutine, since i can't tell if it not changed when using
my $p = Net::Ping->new();

also did you try apply a simple ping from command line - see if it works

Chanan



On 9/18/07, Levenglick Dov-RM07994 <dov at freescale.com> wrote:
> use strict;
> use warnings;
>
> use Net::Ping;
> use threads;
>
> my $num_pings = 10;
> my $host = "223.31.95.254";
>
> threads->create(\&single_ping, $host) for (1..$num_pings);
> map {print $_, $_->join(), "\n"} threads->list();
>
> sub single_ping
> {
>        my $p = Net::Ping->new();
>        return $p->ping(shift);
> }
>
>
> Best Regards,
> Dov Levenglick
> SmartDSP OS Development Team,
> DevTech, Technology and System Organization
> Freescale Semiconductor Israel
> Tel. +972-9-952-2804
> The information contained in this email is classified as:
> [ ] Freescale General Business Information
> [ ] Freescale Internal Use Only
> [ ] Freescale Confidential Proprietary
> [x] Personal Memorandum
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://perl.org.il/mailman/listinfo/perl
>


-- 
===================
----     Chanan Berler    ----
===================



More information about the Perl mailing list