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
|
|
73
|
use 5.008001; |
|
3
|
|
|
|
|
11
|
|
6
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
68
|
|
7
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
147
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
BEGIN { |
10
|
3
|
|
|
3
|
|
8
|
$Types::Standard::Tied::AUTHORITY = 'cpan:TOBYINK'; |
11
|
3
|
|
|
|
|
109
|
$Types::Standard::Tied::VERSION = '2.004000'; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$Types::Standard::Tied::VERSION =~ tr/_//d; |
15
|
|
|
|
|
|
|
|
16
|
3
|
|
|
3
|
|
19
|
use Type::Tiny (); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
53
|
|
17
|
3
|
|
|
3
|
|
16
|
use Types::Standard (); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
67
|
|
18
|
3
|
|
|
3
|
|
17
|
use Types::TypeTiny (); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
195
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
6
|
sub _croak ($;@) { require Error::TypeTiny; goto \&Error::TypeTiny::croak } |
|
1
|
|
|
|
|
8
|
|
21
|
|
|
|
|
|
|
|
22
|
3
|
|
|
3
|
|
19
|
no warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
1520
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub __constraint_generator { |
25
|
37
|
50
|
|
37
|
|
94
|
return Types::Standard->meta->get_type( 'Tied' ) unless @_; |
26
|
|
|
|
|
|
|
|
27
|
37
|
|
|
|
|
89
|
my $param = Types::TypeTiny::to_TypeTiny( shift ); |
28
|
37
|
100
|
|
|
|
654
|
unless ( Types::TypeTiny::is_TypeTiny( $param ) ) { |
29
|
27
|
100
|
|
|
|
200
|
Types::TypeTiny::is_StringLike( $param ) |
30
|
|
|
|
|
|
|
or _croak( "Parameter to Tied[`a] expected to be a class name; got $param" ); |
31
|
26
|
|
|
|
|
1018
|
require Type::Tiny::Class; |
32
|
26
|
|
|
|
|
162
|
$param = "Type::Tiny::Class"->new( class => "$param" ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
36
|
|
|
|
|
152
|
my $check = $param->compiled_check; |
36
|
|
|
|
|
|
|
sub { |
37
|
|
|
|
|
|
|
$check->( |
38
|
|
|
|
|
|
|
tied( |
39
|
11
|
|
|
|
|
82
|
Scalar::Util::reftype( $_ ) eq 'HASH' ? %{$_} |
40
|
11
|
|
|
|
|
97
|
: Scalar::Util::reftype( $_ ) eq 'ARRAY' ? @{$_} |
41
|
33
|
50
|
|
33
|
|
158
|
: Scalar::Util::reftype( $_ ) =~ /^(SCALAR|REF)$/ ? ${$_} |
|
11
|
100
|
|
|
|
117
|
|
|
|
100
|
|
|
|
|
|
42
|
|
|
|
|
|
|
: undef |
43
|
|
|
|
|
|
|
) |
44
|
|
|
|
|
|
|
); |
45
|
36
|
|
|
|
|
192
|
}; |
46
|
|
|
|
|
|
|
} #/ sub __constraint_generator |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub __inline_generator { |
49
|
36
|
|
|
36
|
|
79
|
my $param = Types::TypeTiny::to_TypeTiny( shift ); |
50
|
36
|
100
|
|
|
|
600
|
unless ( Types::TypeTiny::is_TypeTiny( $param ) ) { |
51
|
26
|
50
|
|
|
|
176
|
Types::TypeTiny::is_StringLike( $param ) |
52
|
|
|
|
|
|
|
or _croak( "Parameter to Tied[`a] expected to be a class name; got $param" ); |
53
|
26
|
|
|
|
|
110
|
require Type::Tiny::Class; |
54
|
26
|
|
|
|
|
104
|
$param = "Type::Tiny::Class"->new( class => "$param" ); |
55
|
|
|
|
|
|
|
} |
56
|
36
|
50
|
|
|
|
189
|
return unless $param->can_be_inlined; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub { |
59
|
106
|
|
|
106
|
|
434
|
require B; |
60
|
106
|
|
|
|
|
183
|
my $var = $_[1]; |
61
|
106
|
|
|
|
|
556
|
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
|
|
|
|
|
186
|
} #/ sub __inline_generator |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |