File Coverage

blib/lib/Net/TinyIp/Address/v4.pm
Criterion Covered Total %
statement 12 16 75.0
branch n/a
condition n/a
subroutine 4 5 80.0
pod 0 1 0.0
total 16 22 72.7


line stmt bran cond sub pod time code
1             package Net::TinyIp::Address::v4;
2 1     1   6 use strict;
  1         2  
  1         40  
3 1     1   5 use warnings;
  1         2  
  1         34  
4 1     1   5 use base "Net::TinyIp::Address";
  1         2  
  1         108  
5 1     1   820 use Readonly;
  1         2608  
  1         265  
6              
7             Readonly our $VERSION => 4;
8             Readonly our $BITS_PER_BLOCK => 8;
9             Readonly our $BLOCK_LENGTH => 4;
10             Readonly our $BITS_LENGTH => $BITS_PER_BLOCK * $BLOCK_LENGTH;
11             Readonly our $SEPARATOR => q{.};
12              
13             our $BLOCK_FORMAT = q{%03d};
14              
15             sub from_string {
16 0     0 0   my $class = shift;
17 0           my $str = shift;
18              
19 0           return $class->from_bin( join q{}, q{0b}, map { sprintf "%0${BITS_PER_BLOCK}b", $_ } split m{[$SEPARATOR]}, $str );
  0            
20             }
21              
22             1;
23