Rx/CommonType/EasyNew.pm

filter: Statementstmt 100% 24 / 24 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 4 totaltotal 86.8% 33 / 38 CC 2 SCAR 2.1
CC
2
Cov
96%
guts_from_arg
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Rx/CoreType/int.pm ↑ Summary Rx/CoreType/fail.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 package Data::Rx::CommonType::EasyNew;
4 # ABSTRACT: base class for core Rx types, with some defaults
5 1 $Data::Rx::CommonType::EasyNew::VERSION = '0.200007';
6 1 ▶use parent 'Data::Rx::CommonType';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 sub guts_from_arg {
11 18 ▶ my ($class, $arg, $rx, $type) = @_;
Subroutine guts_from_arg: called CC=2 SCAR=7.1
Pod undocumented
12  
13 18 ▶ Carp::croak "$class does not take check arguments" if %$arg;
Branch: 1 branch
BranchTrueFalseTotal
if %$arg 0 18 18
14  
15 18 return {};
16 }
17  
18 sub new_checker {
19 115 ▶ my ($class, $arg, $rx, $type) = @_;
Subroutine new_checker: called CC=1 SCAR=0.0
Pod undocumented
20  
21 115 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 $guts->{_type} = $type;
25 101 $guts->{_rx} = $rx;
26  
27 101 bless $guts => $class;
28 }
29  
30 1758 ▶sub type { $_[0]->{_type} }
Subroutine type: called CC=1 SCAR=0.0
Pod undocumented
31  
32 3257 ▶sub rx { $_[0]->{_rx} }
Subroutine rx: called CC=1 SCAR=0.0
Pod undocumented
33  
34 #pod =pod
35 #pod
36 #pod =head1 NOTE
37 #pod
38 #pod For examples on how to subclass this, see L<Data::Rx::Manual::CustomTypes>.
39 #pod
40 #pod =cut
41  
42 1 1;
43  
44 __END__
« Rx/CoreType/int.pm ↑ Summary Rx/CoreType/fail.pm »