File Coverage

blib/lib/Data/Rx/CommonType/EasyNew.pm
Criterion Covered Total %
statement 22 22 100.0
branch 1 2 50.0
condition n/a
subroutine 8 8 100.0
pod 0 4 0.0
total 31 36 86.1


line stmt bran cond sub pod time code
1 1     1   290 use strict;
  1         1  
  1         24  
2 1     1   3 use warnings;
  1         1  
  1         39  
3             package Data::Rx::CommonType::EasyNew;
4             # ABSTRACT: base class for core Rx types, with some defaults
5             $Data::Rx::CommonType::EasyNew::VERSION = '0.200007';
6 1     1   3 use parent 'Data::Rx::CommonType';
  1         1  
  1         3  
7              
8 1     1   57 use Carp ();
  1         1  
  1         131  
9              
10             sub guts_from_arg {
11 18     18 0 27 my ($class, $arg, $rx, $type) = @_;
12              
13 18 50       39 Carp::croak "$class does not take check arguments" if %$arg;
14              
15 18         32 return {};
16             }
17              
18             sub new_checker {
19 115     115 0 160 my ($class, $arg, $rx, $type) = @_;
20              
21 115         316 my $guts = $class->guts_from_arg($arg, $rx, $type);
22              
23             # Carp::confess "underscore-led entry in guts!" if grep /\A_/, keys %$guts;
24 101         167 $guts->{_type} = $type;
25 101         122 $guts->{_rx} = $rx;
26              
27 101         255 bless $guts => $class;
28             }
29              
30 1758     1758 0 5330 sub type { $_[0]->{_type} }
31              
32 3257     3257 0 8105 sub rx { $_[0]->{_rx} }
33              
34             #pod =pod
35             #pod
36             #pod =head1 NOTE
37             #pod
38             #pod For examples on how to subclass this, see L.
39             #pod
40             #pod =cut
41              
42             1;
43              
44             __END__