X-Git-Url: https://git.octo.it/?a=blobdiff_plain;ds=sidebyside;f=bindings%2Fperl%2Flib%2FNet%2FOping.pm;h=ba67f739afffcb606a3cc1594b528fb7b9ef7a8d;hb=b525c9c88c988fa45593700d9a4846faa388922a;hp=ff86d4bc22a8d25eaf3ec8cae1579b5d77ec3d8b;hpb=23a712030065e3705b328fd329f7334448c5a00d;p=liboping.git diff --git a/bindings/perl/lib/Net/Oping.pm b/bindings/perl/lib/Net/Oping.pm index ff86d4b..ba67f73 100644 --- a/bindings/perl/lib/Net/Oping.pm +++ b/bindings/perl/lib/Net/Oping.pm @@ -19,7 +19,7 @@ # # Authors: # Olivier Fredj -# Florian octo Forster +# Florian octo Forster # package Net::Oping; @@ -30,7 +30,7 @@ Net::Oping - ICMP latency measurement module using the oping library. =head1 SYNOPSIS - use Net::Oping; + use Net::Oping (); my $obj = Net::Oping->new (); $obj->host_add (qw(one.example.org two.example.org)); @@ -41,11 +41,11 @@ Net::Oping - ICMP latency measurement module using the oping library. =head1 DESCRIPTION This Perl module is a high-level interface to the -L. Its purpose it to send -C packets (also known as "ping") to a host and measure the -time that elapses until the reception of an C packet (also -known as "pong"). If no such packet is received after a certain timeout the -host is considered to be unreachable. +L. Its purpose it to send C +packets (also known as "ping") to a host and measure the time that elapses +until the reception of an C packet (also known as "pong"). If +no such packet is received after a certain timeout the host is considered to be +unreachable. The used I library supports "ping"ing multiple hosts in parallel and works with IPv4 and IPv6 transparently. Other advanced features that are @@ -61,7 +61,7 @@ use warnings; use Carp (qw(cluck confess)); -our $VERSION = '1.02'; +our $VERSION = '1.21'; require XSLoader; XSLoader::load ('Net::Oping', $VERSION); @@ -171,6 +171,35 @@ sub bind return (1); } +=item I<$status> = I<$obj>-EB (I<$device>); + +Sets the network device used for communication. This may not be supported on +all platforms. + +I + +=cut + +sub device +{ + my $obj = shift; + my $device = shift; + my $status; + + $status = _ping_setopt_device ($obj->{'c_obj'}, $device); + if ($status == -95) # Feature not supported. + { + $obj->{'err_msg'} = "Feature not supported by your version of liboping."; + } + elsif ($status != 0) + { + $obj->{'err_msg'} = "" . _ping_get_error ($obj->{'c_obj'}); + return; + } + + return (1); +} + =item I<$status> = I<$obj>-EB (I<$host>, [I<$host>, ...]); Adds one or more hosts to the Net::Oping-object I<$obj>. The number of @@ -403,11 +432,11 @@ superuser or, under Linux, needs the C capability. L -The I homepage may be found at L. +The I homepage may be found at L. Information about its mailing list may be found at L. -=head1 AUTHOR +=head1 AUTHORS First XSEport by Olivier Fredj, extended XS functionality and high-level Perl interface by Florian Forster. @@ -416,8 +445,7 @@ Perl interface by Florian Forster. Copyright (C) 2007 by Olivier Fredj EofredjEatEproxad.netE -Copyright (C) 2008,2009 by Florian Forster -EoctoEatEverplant.orgE +Copyright (C) 2008,2009 by Florian Forster EffEatEocto.itE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or,