line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
3
|
3
|
|
|
3
|
|
21
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
90
|
|
4
|
3
|
|
|
3
|
|
14
|
|
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
134
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.48'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Role::Tiny::With; |
8
|
3
|
|
|
3
|
|
16
|
use Scalar::Util (); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
145
|
|
9
|
3
|
|
|
3
|
|
16
|
use Specio::Helpers qw( perlstring ); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
50
|
|
10
|
3
|
|
|
3
|
|
12
|
use Specio::Library::Builtins; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
107
|
|
11
|
3
|
|
|
3
|
|
15
|
use Specio::OO; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
23
|
|
12
|
3
|
|
|
3
|
|
17
|
|
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
171
|
|
13
|
|
|
|
|
|
|
use Specio::Constraint::Role::IsaType; |
14
|
3
|
|
|
3
|
|
827
|
with 'Specio::Constraint::Role::IsaType'; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
500
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
{ |
17
|
|
|
|
|
|
|
my $Defined = t('Defined'); |
18
|
|
|
|
|
|
|
} |
19
|
4
|
|
|
4
|
|
34
|
|
20
|
|
|
|
|
|
|
{ |
21
|
|
|
|
|
|
|
my $_inline_generator = sub { |
22
|
|
|
|
|
|
|
my $self = shift; |
23
|
|
|
|
|
|
|
my $val = shift; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
return sprintf( <<'EOF', ($val) x 7, perlstring( $self->class ) ); |
26
|
|
|
|
|
|
|
( |
27
|
|
|
|
|
|
|
( |
28
|
|
|
|
|
|
|
Scalar::Util::blessed(%s) |
29
|
|
|
|
|
|
|
|| ( |
30
|
|
|
|
|
|
|
defined(%s) |
31
|
|
|
|
|
|
|
&& !ref(%s) |
32
|
|
|
|
|
|
|
&& length(%s) |
33
|
|
|
|
|
|
|
&& %s !~ /\A |
34
|
|
|
|
|
|
|
\s* |
35
|
|
|
|
|
|
|
-?[0-9]+(?:\.[0-9]+)? |
36
|
|
|
|
|
|
|
(?:[Ee][\-+]?[0-9]+)? |
37
|
|
|
|
|
|
|
\s* |
38
|
|
|
|
|
|
|
\z/xs |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# Passing a GLOB from (my $glob = *GLOB) gives us a very weird |
41
|
|
|
|
|
|
|
# scalar. It's not a ref and it has a length but trying to |
42
|
|
|
|
|
|
|
# call ->can on it throws an exception |
43
|
|
|
|
|
|
|
&& ref( \%s ) ne 'GLOB' |
44
|
|
|
|
|
|
|
) |
45
|
|
|
|
|
|
|
) |
46
|
|
|
|
|
|
|
&& %s->isa(%s) |
47
|
|
|
|
|
|
|
) |
48
|
|
|
|
|
|
|
EOF |
49
|
|
|
|
|
|
|
}; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
4
|
|
|
4
|
|
135
|
## no critic (Subroutines::ProhibitUnusedPrivateSubroutines) |
54
|
|
|
|
|
|
|
## use critic |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__PACKAGE__->_ooify; |
57
|
4
|
|
|
4
|
|
9
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# ABSTRACT: A class for constraints which require a class name or an object that inherit from a specific class |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=pod |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=encoding UTF-8 |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 NAME |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Specio::Constraint::AnyIsa - A class for constraints which require a class name or an object that inherit from a specific class |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 VERSION |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
version 0.48 |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 SYNOPSIS |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
my $type = Specio::Constraint::AnyIsa->new(...); |
78
|
|
|
|
|
|
|
print $type->class; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 DESCRIPTION |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This is a specialized type constraint class for types which require a class |
83
|
|
|
|
|
|
|
name or an object that inherit from a specific class. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 API |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This class provides all of the same methods as L<Specio::Constraint::Simple>, |
88
|
|
|
|
|
|
|
with a few differences: |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 Specio::Constraint::AnyIsa->new( ... ) |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
The C<parent> parameter is ignored if it passed, as it is always set to the |
93
|
|
|
|
|
|
|
C<Defined> type. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
The C<inline_generator> and C<constraint> parameters are also ignored. This |
96
|
|
|
|
|
|
|
class provides its own default inline generator subroutine reference. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This class overrides the C<message_generator> default if none is provided. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Finally, this class requires an additional parameter, C<class>. This must be a |
101
|
|
|
|
|
|
|
single class name. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head2 $any_isa->class |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Returns the class name passed to the constructor. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 ROLES |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This class does the L<Specio::Constraint::Role::IsaType>, |
110
|
|
|
|
|
|
|
L<Specio::Constraint::Role::Interface>, and L<Specio::Role::Inlinable> roles. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 SUPPORT |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/Specio/issues>. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 SOURCE |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
The source code repository for Specio can be found at L<https://github.com/houseabsolute/Specio>. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 AUTHOR |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
This software is Copyright (c) 2012 - 2022 by Dave Rolsky. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
This is free software, licensed under: |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
The full text of the license can be found in the |
133
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=cut |