| 1 | package Type::Tiny::_DeclaredType; | ||||||||||
| 2 | |||||||||||
| 3 | 54 | ▶ | use 5.008001; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 54 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 54 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 54 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 54 | $Type::Tiny::_DeclaredType::AUTHORITY = 'cpan:TOBYINK'; | |||||||||
| 9 | 54 | $Type::Tiny::_DeclaredType::VERSION = '2.010001'; | |||||||||
| 10 | } | ||||||||||
| 11 | |||||||||||
| 12 | 54 | $Type::Tiny::_DeclaredType::VERSION =~ tr/_//d; | |||||||||
| 13 | |||||||||||
| 14 | 54 | ▶ | use Type::Tiny (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 54 | our @ISA = qw( Type::Tiny ); | |||||||||
| 16 | |||||||||||
| 17 | 541 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||
| 18 | 541 | my $class = shift; | |||||||||
| 19 | 0 | ▶ | my %opts = @_ == 1 ? %{ +shift } : @_; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | |||||||||||
| 21 | 541 | my $library = delete $opts{library}; | |||||||||
| 22 | 541 | my $name = delete $opts{name}; | |||||||||
| 23 | |||||||||||
| 24 | 541 | ▶ | $library->can( 'get_type' ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | or Type::Tiny::_croak( "Expected $library to be a type library, but it doesn't seem to be" ); | ||||||||||
| 26 | |||||||||||
| 27 | 541 | $opts{display_name} = $name; | |||||||||
| 28 | 2 | ▶ | $opts{constraint} = sub { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||
| 29 | 2 | ▶ | my $val = @_ ? pop : $_; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | 2 | $library->get_type( $name )->check( $val ); | |||||||||
| 31 | 541 | }; | |||||||||
| 32 | 135 | ▶ | $opts{inlined} = sub { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||
| 33 | 135 | ▶ | my $val = @_ ? pop : $_; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | 135 | sprintf( '%s::is_%s(%s)', $library, $name, $val ); | |||||||||
| 35 | 541 | }; | |||||||||
| 36 | 7 | ▶ | $opts{_build_coercion} = sub { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||
| 37 | 7 | my $realtype = $library->get_type( $name ); | |||||||||
| 38 | 7 | ▶ | $_[0] = $realtype->coercion if $realtype; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 541 | }; | |||||||||
| 40 | 541 | $class->SUPER::new( %opts ); | |||||||||
| 41 | } #/ sub new | ||||||||||
| 42 | |||||||||||
| 43 | 54 | 1; | |||||||||
| 44 | |||||||||||
| 45 | __END__ | ||||||||||