ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-FastPing/t/01_ping.t
Revision: 1.4
Committed: Wed Feb 2 20:04:17 2011 UTC (13 years, 4 months ago) by root
Content type: application/x-troff
Branch: MAIN
CVS Tags: rel-2_03, rel-2_02, rel-2_01, rel-2_0, rel-2_1, HEAD
Changes since 1.3: +11 -3 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.2 BEGIN { $> and do { print "1..0 # skipped: will only run ping tests as root\n"; exit } }
2    
3 root 1.1 print "1..4\n";
4    
5     use strict;
6    
7     use AnyEvent;
8 root 1.3 use AnyEvent::FastPing;
9 root 1.1
10     my $done = AnyEvent->condvar;
11    
12     print "ok 1\n";
13    
14 root 1.4 my $pinger = new AnyEvent::FastPing;
15    
16     $pinger->max_rtt (0.01);
17     $pinger->add_range (v127.0.0.1, v127.0.0.255);
18     $pinger->add_range (v127.0.1.1, v127.0.1.005);
19    
20     $pinger->on_idle (sub {
21     print "ok 3\n";
22     $done->();
23     });
24 root 1.1
25     print "ok 2\n";
26    
27 root 1.4 $pinger->start;
28 root 1.1 $done->wait;
29    
30     print "ok 4\n";