| |
---|
| | # End of the overload methods. |
---|
| | ############################################# |
---|
| | |
---|
| | |
---|
| | our $VERSION = '3.07'; |
---|
| | our $VERSION = '3.08'; |
---|
| | |
---|
| | # Preloaded methods go here. |
---|
| | |
---|
| | # This is a variant to ->new() that |
---|
| |
---|
| | vec($bmask, 2, 8) = 0; |
---|
| | vec($bmask, 3, 8) = 0; |
---|
| | } |
---|
| | elsif ($mask =~ m/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/) { |
---|
| | |
---|
| | for my $i ($1, $2, $3, $4) { |
---|
| | return undef |
---|
| | unless grep { $i == $_ } |
---|
| | (255, 254, 252, 248, 224, 192, 160, 128, 0); |
---|
| | } |
---|
| | |
---|
| | return undef if ($1 < $2 or $2 < $3 or $3 < $4); |
---|
| | |
---|
| | return undef if $2 != 0 and $1 != 255; |
---|
| | return undef if $3 != 0 and $2 != 255; |
---|
| | return undef if $4 != 0 and $3 != 255; |
---|
| | |
---|
| | vec($bmask, 0, 8) = $1; |
---|
| | vec($bmask, 1, 8) = $2; |
---|
| | vec($bmask, 2, 8) = $3; |
---|
| | vec($bmask, 3, 8) = $4; |
---|
| |
---|
| | } |
---|
| | |
---|
| | if (defined $_[2]) { |
---|
| | $mask = _parse_mask $_[2], 32; |
---|
| | return undef unless defined $mask; |
---|
| | } |
---|
| | elsif (defined $mask) { |
---|
| | $mask = _parse_mask $mask, 32; |
---|
| | return undef unless defined $mask; |
---|
| | } |
---|
| | else { |
---|
| | $hasmask = 0; |
---|
| | $mask = _parse_mask 32, 32; |
---|
| | return undef unless defined $mask; |
---|
| | } |
---|
| | |
---|
| | my $self = _v4($ip, $mask, $hasmask); |
---|
| | |
---|
| |
---|
| | return ~vec($self->{mask}, 0, $self->{bits}) & 0xFFFFFFFF; |
---|
| | } |
---|
| | |
---|
| | 1; |
---|
| | |
---|
| | __END__ |
---|
| | |
---|
| | =head1 NAME |
---|
| | |
---|
| |
---|
| | A small bug related to parsing of 'localhost' was fixed. |
---|
| | |
---|
| | =back |
---|
| | |
---|
| | =item 3.08 |
---|
| | |
---|
| | =over |
---|
| | |
---|
| | =item * |
---|
| | |
---|
| | By popular request, C<-E<gt>new()> now checks the sanity of the netmasks |
---|
| | it receives. If the netmask is invalid, C<undef> will be returned. |
---|
| | |
---|
| | =back |
---|
| | |
---|
| | =back |
---|
| | |
---|
| | =head1 AUTHOR |
---|
| | |
---|
| |
---|
| | |
|