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