File Coverage

blib/lib/Digital/Role.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 13 14 92.8


line stmt bran cond sub pod time code
1             package Digital::Role;
2             BEGIN {
3 3     3   40322 $Digital::Role::AUTHORITY = 'cpan:GETTY';
4             }
5             # ABSTRACT: Base role for Digital driver (positive integer input)
6             $Digital::Role::VERSION = '0.002';
7 3     3   764 use Moo::Role;
  3         144178  
  3         16  
8 3     3   699 use Carp qw( croak );
  3         4  
  3         438  
9              
10             sub input {
11 2     2 0 6 my ( $class, $input, %args ) = @_;
12 2         17 return $class->new( in => $input, %args );
13             }
14              
15             has in => (
16             is => 'ro',
17             isa => sub {
18             croak "Digital input must be positive integer!"
19             unless $_[0] =~ /^\d+$/ and $_[0] >= 0;
20             },
21             required => 1,
22             );
23              
24             1;
25              
26             __END__