line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
3
|
30
|
|
|
30
|
|
161
|
use warnings; |
|
30
|
|
|
|
|
46
|
|
|
30
|
|
|
|
|
702
|
|
4
|
30
|
|
|
30
|
|
158
|
|
|
30
|
|
|
|
|
44
|
|
|
30
|
|
|
|
|
645
|
|
5
|
|
|
|
|
|
|
use parent 'Exporter'; |
6
|
30
|
|
|
30
|
|
156
|
|
|
30
|
|
|
|
|
45
|
|
|
30
|
|
|
|
|
132
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.48'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Carp qw( confess croak ); |
10
|
30
|
|
|
30
|
|
1790
|
|
|
30
|
|
|
|
|
65
|
|
|
30
|
|
|
|
|
7001
|
|
11
|
|
|
|
|
|
|
our @EXPORT_OK |
12
|
|
|
|
|
|
|
= qw( exportable_types_for_package internal_types_for_package register ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my %Registry; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
confess |
17
|
|
|
|
|
|
|
'register requires three or four arguments (package, name, type, [exportable])' |
18
|
3184
|
50
|
33
|
3184
|
0
|
10096
|
unless @_ == 3 || @_ == 4; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $package = shift; |
21
|
|
|
|
|
|
|
my $name = shift; |
22
|
3184
|
|
|
|
|
4006
|
my $type = shift; |
23
|
3184
|
|
|
|
|
3355
|
my $exportable = shift; |
24
|
3184
|
|
|
|
|
3224
|
|
25
|
3184
|
|
|
|
|
3396
|
croak "The $package package already has a type named $name" |
26
|
|
|
|
|
|
|
if $Registry{$package}{internal}{$name}; |
27
|
|
|
|
|
|
|
|
28
|
3184
|
100
|
|
|
|
5849
|
# This is structured so that we can always return a _reference_ for |
29
|
|
|
|
|
|
|
# *_types_for_package. This means that the generated t sub sees any |
30
|
|
|
|
|
|
|
# changes to the registry as they happen. This is important inside a |
31
|
|
|
|
|
|
|
# package that is declaring new types. It needs to be able to see types it |
32
|
|
|
|
|
|
|
# has declared. |
33
|
|
|
|
|
|
|
$Registry{$package}{internal}{$name} = $type; |
34
|
|
|
|
|
|
|
$Registry{$package}{exportable}{$name} = $type |
35
|
3183
|
|
|
|
|
5209
|
if $exportable; |
36
|
3183
|
100
|
|
|
|
4728
|
|
37
|
|
|
|
|
|
|
return; |
38
|
|
|
|
|
|
|
} |
39
|
3183
|
|
|
|
|
6005
|
|
40
|
|
|
|
|
|
|
my $package = shift; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
return $Registry{$package}{exportable} ||= {}; |
43
|
172
|
|
|
172
|
0
|
253
|
} |
44
|
|
|
|
|
|
|
|
45
|
172
|
|
50
|
|
|
635
|
my $package = shift; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
return $Registry{$package}{internal} ||= {}; |
48
|
|
|
|
|
|
|
} |
49
|
277
|
|
|
277
|
0
|
438
|
|
50
|
|
|
|
|
|
|
1; |
51
|
277
|
|
100
|
|
|
1638
|
|
52
|
|
|
|
|
|
|
# ABSTRACT: Implements the per-package type registry |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=pod |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=encoding UTF-8 |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 NAME |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Specio::Registry - Implements the per-package type registry |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 VERSION |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
version 0.48 |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 DESCRIPTION |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
There's nothing public here. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=for Pod::Coverage .* |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 SUPPORT |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/Specio/issues>. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 SOURCE |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
The source code repository for Specio can be found at L<https://github.com/houseabsolute/Specio>. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 AUTHOR |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This software is Copyright (c) 2012 - 2022 by Dave Rolsky. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This is free software, licensed under: |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
The full text of the license can be found in the |
94
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |