line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# INTERNAL MODULE: guts for Tied type from Types::Standard. |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Types::Standard::Tied; |
4
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
58
|
use 5.008001; |
|
3
|
|
|
|
|
10
|
|
6
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
70
|
|
7
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
202
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
BEGIN { |
10
|
3
|
|
|
3
|
|
10
|
$Types::Standard::Tied::AUTHORITY = 'cpan:TOBYINK'; |
11
|
3
|
|
|
|
|
117
|
$Types::Standard::Tied::VERSION = '2.002001'; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$Types::Standard::Tied::VERSION =~ tr/_//d; |
15
|
|
|
|
|
|
|
|
16
|
3
|
|
|
3
|
|
22
|
use Type::Tiny (); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
66
|
|
17
|
3
|
|
|
3
|
|
23
|
use Types::Standard (); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
64
|
|
18
|
3
|
|
|
3
|
|
16
|
use Types::TypeTiny (); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
224
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
432
|
sub _croak ($;@) { require Error::TypeTiny; goto \&Error::TypeTiny::croak } |
|
1
|
|
|
|
|
6
|
|
21
|
|
|
|
|
|
|
|
22
|
3
|
|
|
3
|
|
22
|
no warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
1583
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub __constraint_generator { |
25
|
37
|
50
|
|
37
|
|
88
|
return Types::Standard->meta->get_type( 'Tied' ) unless @_; |
26
|
|
|
|
|
|
|
|
27
|
37
|
|
|
|
|
77
|
my $param = Types::TypeTiny::to_TypeTiny( shift ); |
28
|
37
|
100
|
|
|
|
614
|
unless ( Types::TypeTiny::is_TypeTiny( $param ) ) { |
29
|
27
|
100
|
|
|
|
184
|
Types::TypeTiny::is_StringLike( $param ) |
30
|
|
|
|
|
|
|
or _croak( "Parameter to Tied[`a] expected to be a class name; got $param" ); |
31
|
26
|
|
|
|
|
1053
|
require Type::Tiny::Class; |
32
|
26
|
|
|
|
|
108
|
$param = "Type::Tiny::Class"->new( class => "$param" ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
36
|
|
|
|
|
137
|
my $check = $param->compiled_check; |
36
|
|
|
|
|
|
|
sub { |
37
|
|
|
|
|
|
|
$check->( |
38
|
|
|
|
|
|
|
tied( |
39
|
11
|
|
|
|
|
78
|
Scalar::Util::reftype( $_ ) eq 'HASH' ? %{$_} |
40
|
11
|
|
|
|
|
79
|
: Scalar::Util::reftype( $_ ) eq 'ARRAY' ? @{$_} |
41
|
33
|
50
|
|
33
|
|
147
|
: Scalar::Util::reftype( $_ ) =~ /^(SCALAR|REF)$/ ? ${$_} |
|
11
|
100
|
|
|
|
84
|
|
|
|
100
|
|
|
|
|
|
42
|
|
|
|
|
|
|
: undef |
43
|
|
|
|
|
|
|
) |
44
|
|
|
|
|
|
|
); |
45
|
36
|
|
|
|
|
193
|
}; |
46
|
|
|
|
|
|
|
} #/ sub __constraint_generator |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub __inline_generator { |
49
|
36
|
|
|
36
|
|
78
|
my $param = Types::TypeTiny::to_TypeTiny( shift ); |
50
|
36
|
100
|
|
|
|
577
|
unless ( Types::TypeTiny::is_TypeTiny( $param ) ) { |
51
|
26
|
50
|
|
|
|
158
|
Types::TypeTiny::is_StringLike( $param ) |
52
|
|
|
|
|
|
|
or _croak( "Parameter to Tied[`a] expected to be a class name; got $param" ); |
53
|
26
|
|
|
|
|
100
|
require Type::Tiny::Class; |
54
|
26
|
|
|
|
|
97
|
$param = "Type::Tiny::Class"->new( class => "$param" ); |
55
|
|
|
|
|
|
|
} |
56
|
36
|
50
|
|
|
|
152
|
return unless $param->can_be_inlined; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub { |
59
|
106
|
|
|
106
|
|
433
|
require B; |
60
|
106
|
|
|
|
|
151
|
my $var = $_[1]; |
61
|
106
|
|
|
|
|
510
|
sprintf( |
62
|
|
|
|
|
|
|
"%s and do { my \$TIED = tied(Scalar::Util::reftype($var) eq 'HASH' ? \%{$var} : Scalar::Util::reftype($var) eq 'ARRAY' ? \@{$var} : Scalar::Util::reftype($var) =~ /^(SCALAR|REF)\$/ ? \${$var} : undef); %s }", |
63
|
|
|
|
|
|
|
Types::Standard::Ref()->inline_check( $var ), |
64
|
|
|
|
|
|
|
$param->inline_check( '$TIED' ) |
65
|
|
|
|
|
|
|
); |
66
|
|
|
|
|
|
|
} |
67
|
36
|
|
|
|
|
170
|
} #/ sub __inline_generator |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |