Subject: | die option defect? |
Date: | Thu, 01 Oct 2009 10:51:50 +0100 |
To: | bug-Net-MAC [...] rt.cpan.org |
From: | Guy Edwards <guy.edwards [...] oucs.ox.ac.uk> |
Dear Oliver,
short version:
I think the 'die' => 0 option may have a defect.
...or I have missed something which is also possible.
Long version:
I have a script that uses Net::MAC to match against valid mac addresses
I've have the problem that when feeding net::mac a known invalid mac
address it's croaking the script instead of returning a failure, despite
using the die=>0 setting.
so I have
my $submitted='00:1e:ob:57:5f:20'; # invalid o
my $mac = Net::MAC->new('mac' => $formatted, 'die' => 0 );
if ( defined $mac ){
[...something...]
}
else {
# hey I was given an
# invalid MAC address
}
Which when fed with a known bad mac causes
[error] [...] discovery of
MAC address metadata failed, invalid characters in MAC address
"00:1e:ob:57:5f:20" at foo-script line $foo
...which is correct but I don't want the page to die, I want to know
they've submitted an invalid mac address and then tell them so via the
script
I tried verbose 1 as well with another invalid address:
setting "die" to default value "1" setting "die" to "0" setting "mac" to
"0018.6e49.4o4c" initialized object into class Net::MAC setting
attribute "delimiter" to "." setting attribute "bit_group" to "16"
Net::MAC detected an error: discovery of MAC address metadata failed,
invalid characters in MAC address "0018.6e49.4o4c"
Cheers
Guy