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