X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=bindings%2Fperl%2Flib%2FNet%2FOping.pm;h=47993dcc093e26b32ab74d169940ae28e75da949;hb=d0feb43395e766c2e2fc988d2ada8965595978ce;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..47993dc 100644 --- a/bindings/perl/lib/Net/Oping.pm +++ b/bindings/perl/lib/Net/Oping.pm @@ -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)); @@ -61,7 +61,7 @@ use warnings; use Carp (qw(cluck confess)); -our $VERSION = '1.02'; +our $VERSION = '1.20'; 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 @@ -407,7 +436,7 @@ 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.