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
|
|
61
|
use 5.008001; |
|
3
|
|
|
|
|
11
|
|
6
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
69
|
|
7
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
153
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
BEGIN { |
10
|
3
|
|
|
3
|
|
10
|
$Types::Standard::Tied::AUTHORITY = 'cpan:TOBYINK'; |
11
|
3
|
|
|
|
|
108
|
$Types::Standard::Tied::VERSION = '2.003_000'; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$Types::Standard::Tied::VERSION =~ tr/_//d; |
15
|
|
|
|
|
|
|
|
16
|
3
|
|
|
3
|
|
24
|
use Type::Tiny (); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
49
|
|
17
|
3
|
|
|
3
|
|
15
|
use Types::Standard (); |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
51
|
|
18
|
3
|
|
|
3
|
|
15
|
use Types::TypeTiny (); |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
188
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
7
|
sub _croak ($;@) { require Error::TypeTiny; goto \&Error::TypeTiny::croak } |
|
1
|
|
|
|
|
8
|
|
21
|
|
|
|
|
|
|
|
22
|
3
|
|
|
3
|
|
18
|
no warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
1519
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub __constraint_generator { |
25
|
37
|
50
|
|
37
|
|
96
|
return Types::Standard->meta->get_type( 'Tied' ) unless @_; |
26
|
|
|
|
|
|
|
|
27
|
37
|
|
|
|
|
93
|
my $param = Types::TypeTiny::to_TypeTiny( shift ); |
28
|
37
|
100
|
|
|
|
629
|
unless ( Types::TypeTiny::is_TypeTiny( $param ) ) { |
29
|
27
|
100
|
|
|
|
243
|
Types::TypeTiny::is_StringLike( $param ) |
30
|
|
|
|
|
|
|
or _croak( "Parameter to Tied[`a] expected to be a class name; got $param" ); |
31
|
26
|
|
|
|
|
1086
|
require Type::Tiny::Class; |
32
|
26
|
|
|
|
|
113
|
$param = "Type::Tiny::Class"->new( class => "$param" ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
36
|
|
|
|
|
161
|
my $check = $param->compiled_check; |
36
|
|
|
|
|
|
|
sub { |
37
|
|
|
|
|
|
|
$check->( |
38
|
|
|
|
|
|
|
tied( |
39
|
11
|
|
|
|
|
85
|
Scalar::Util::reftype( $_ ) eq 'HASH' ? %{$_} |
40
|
11
|
|
|
|
|
94
|
: Scalar::Util::reftype( $_ ) eq 'ARRAY' ? @{$_} |
41
|
33
|
50
|
|
33
|
|
225
|
: Scalar::Util::reftype( $_ ) =~ /^(SCALAR|REF)$/ ? ${$_} |
|
11
|
100
|
|
|
|
100
|
|
|
|
100
|
|
|
|
|
|
42
|
|
|
|
|
|
|
: undef |
43
|
|
|
|
|
|
|
) |
44
|
|
|
|
|
|
|
); |
45
|
36
|
|
|
|
|
200
|
}; |
46
|
|
|
|
|
|
|
} #/ sub __constraint_generator |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub __inline_generator { |
49
|
36
|
|
|
36
|
|
80
|
my $param = Types::TypeTiny::to_TypeTiny( shift ); |
50
|
36
|
100
|
|
|
|
615
|
unless ( Types::TypeTiny::is_TypeTiny( $param ) ) { |
51
|
26
|
50
|
|
|
|
144
|
Types::TypeTiny::is_StringLike( $param ) |
52
|
|
|
|
|
|
|
or _croak( "Parameter to Tied[`a] expected to be a class name; got $param" ); |
53
|
26
|
|
|
|
|
104
|
require Type::Tiny::Class; |
54
|
26
|
|
|
|
|
99
|
$param = "Type::Tiny::Class"->new( class => "$param" ); |
55
|
|
|
|
|
|
|
} |
56
|
36
|
50
|
|
|
|
180
|
return unless $param->can_be_inlined; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub { |
59
|
106
|
|
|
106
|
|
443
|
require B; |
60
|
106
|
|
|
|
|
163
|
my $var = $_[1]; |
61
|
106
|
|
|
|
|
530
|
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
|
|
|
|
|
182
|
} #/ sub __inline_generator |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |