Subject: | bug in Net::ISC::DHCPd::OMAPI::Actions->read |
Date: | Wed, 24 Oct 2012 11:26:05 +0300 |
To: | bug-Net-ISC-DHCPd [...] rt.cpan.org |
From: | Oleg Gawriloff <barzog [...] telecom.by> |
According to docs read should return 0 when lease is not found on the
server.
Instead it returns 1.
Sample:
#!/usr/bin/perl -w
use strict;
use warnings;
use diagnostics;
use Net::ISC::DHCPd;
use Data::Dumper;
my ($dhcpd,$lease,%lease_attrs,$tmp);
$dhcpd=Net::ISC::DHCPd->new(omapi=>{key=>'omapi_key <some
Show quoted text
key>',server=>'<some ip>',port=>9991});
$dhcpd->omapi->connect();
$lease_attrs{'ip_address'}='1.1.1.1';
$lease=$dhcpd->omapi->new_object(lease=>%lease_attrs);
$tmp=$lease->read;
print "R: $tmp D:\n".Dumper(\$lease)."\n";
exit(0);
So, 1.1.1.1 is not in leases file:
R: 1 D:
$VAR1 = \bless( {
'extra_attributes' => {},
'errstr' => '',
'parent' => bless( {
'errstr' => '',
'_pid' => 28345,
'server' => '<some ip>',
'_fh' => bless( \*Symbol::GEN0,
'IO::Pty' ),
'port' => 9991,
'key' => 'omapi_key <some key>'
}, 'Net::ISC::DHCPd::OMAPI' ),
'ip_address' => '1.1.1.1'
}, 'Net::ISC::DHCPd::OMAPI::Lease' );
--
Signed, Oleg Gawriloff.