line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# This file is part of Reindeer |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# This software is Copyright (c) 2017, 2015, 2014, 2012, 2011 by Chris Weyl. |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# This is free software, licensed under: |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# The GNU Lesser General Public License, Version 2.1, February 1999 |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
package Reindeer::Util; |
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:RSRCHBOY'; |
12
|
|
|
|
|
|
|
$Reindeer::Util::VERSION = '0.019'; |
13
|
|
|
|
|
|
|
# ABSTRACT: Common and utility functions for Reindeer |
14
|
|
|
|
|
|
|
|
15
|
11
|
|
|
11
|
|
273434
|
use strict; |
|
11
|
|
|
|
|
28
|
|
|
11
|
|
|
|
|
278
|
|
16
|
11
|
|
|
11
|
|
53
|
use warnings; |
|
11
|
|
|
|
|
58
|
|
|
11
|
|
|
|
|
354
|
|
17
|
|
|
|
|
|
|
|
18
|
11
|
|
|
|
|
112
|
use Sub::Exporter -setup => { |
19
|
|
|
|
|
|
|
exports => [ qw{ trait_aliases as_is also_list type_libraries } ], |
20
|
11
|
|
|
11
|
|
858
|
}; |
|
11
|
|
|
|
|
17891
|
|
21
|
|
|
|
|
|
|
|
22
|
11
|
|
|
11
|
|
5771
|
use Class::Load 'load_class'; |
|
11
|
|
|
|
|
14122
|
|
|
11
|
|
|
|
|
531
|
|
23
|
|
|
|
|
|
|
|
24
|
11
|
|
|
11
|
|
4253
|
use Moose 1.15 ( ); |
|
11
|
|
|
|
|
2218410
|
|
|
11
|
|
|
|
|
431
|
|
25
|
11
|
|
|
11
|
|
6027
|
use MooseX::AlwaysCoerce 0.16 ( ); |
|
11
|
|
|
|
|
1043554
|
|
|
11
|
|
|
|
|
450
|
|
26
|
11
|
|
|
11
|
|
5470
|
use MooseX::AbstractMethod 0.003 ( ); |
|
11
|
|
|
|
|
164475
|
|
|
11
|
|
|
|
|
510
|
|
27
|
11
|
|
|
11
|
|
5909
|
use MooseX::AttributeShortcuts 0.017 ( ); |
|
11
|
|
|
|
|
3838592
|
|
|
11
|
|
|
|
|
446
|
|
28
|
11
|
|
|
11
|
|
87
|
use MooseX::ClassAttribute 0.26 ( ); |
|
11
|
|
|
|
|
150
|
|
|
11
|
|
|
|
|
182
|
|
29
|
11
|
|
|
11
|
|
4663
|
use MooseX::CurriedDelegation ( ); |
|
11
|
|
|
|
|
8444
|
|
|
11
|
|
|
|
|
282
|
|
30
|
11
|
|
|
11
|
|
3913
|
use MooseX::LazyRequire 0.07 ( ); |
|
11
|
|
|
|
|
87449
|
|
|
11
|
|
|
|
|
307
|
|
31
|
11
|
|
|
11
|
|
4407
|
use MooseX::MarkAsMethods 0.14 ( ); |
|
11
|
|
|
|
|
82697
|
|
|
11
|
|
|
|
|
352
|
|
32
|
11
|
|
|
11
|
|
4331
|
use MooseX::NewDefaults 0.003 ( ); |
|
11
|
|
|
|
|
11837
|
|
|
11
|
|
|
|
|
287
|
|
33
|
11
|
|
|
11
|
|
3918
|
use MooseX::StrictConstructor 0.19 ( ); |
|
11
|
|
|
|
|
155444
|
|
|
11
|
|
|
|
|
293
|
|
34
|
11
|
|
|
11
|
|
72
|
use MooseX::Types::Moose 0.31 ( ); |
|
11
|
|
|
|
|
219
|
|
|
11
|
|
|
|
|
213
|
|
35
|
11
|
|
|
11
|
|
53
|
use MooseX::Types::Common::String 0.001004 ( ); |
|
11
|
|
|
|
|
166
|
|
|
11
|
|
|
|
|
206
|
|
36
|
11
|
|
|
11
|
|
4681
|
use MooseX::Types::Common::Numeric 0.001004 ( ); |
|
11
|
|
|
|
|
581364
|
|
|
11
|
|
|
|
|
408
|
|
37
|
11
|
|
|
11
|
|
5396
|
use MooseX::Types::LoadableClass 0.006 ( ); |
|
11
|
|
|
|
|
553420
|
|
|
11
|
|
|
|
|
427
|
|
38
|
11
|
|
|
11
|
|
5471
|
use MooseX::Types::Path::Class 0.05 ( ); |
|
11
|
|
|
|
|
746008
|
|
|
11
|
|
|
|
|
429
|
|
39
|
11
|
|
|
11
|
|
5655
|
use MooseX::Types::Tied::Hash::IxHash 0.003 ( ); |
|
11
|
|
|
|
|
445699
|
|
|
11
|
|
|
|
|
382
|
|
40
|
|
|
|
|
|
|
|
41
|
11
|
|
|
11
|
|
5388
|
use MooseX::Params::Validate 0.016 ( ); |
|
11
|
|
|
|
|
568141
|
|
|
11
|
|
|
|
|
306
|
|
42
|
11
|
|
|
11
|
|
81
|
use Path::Class 0.24 ( ); |
|
11
|
|
|
|
|
153
|
|
|
11
|
|
|
|
|
241
|
|
43
|
11
|
|
|
11
|
|
55
|
use Try::Tiny 0.11 ( ); |
|
11
|
|
|
|
|
172
|
|
|
11
|
|
|
|
|
2270
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# SlurpyConstructor, Params::Validate |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub trait_aliases { |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# note that merely specifing aliases does not load the packages; Moose |
51
|
|
|
|
|
|
|
# will handle that when (if) the trait is ever used. |
52
|
|
|
|
|
|
|
return ( |
53
|
17
|
|
|
17
|
1
|
185
|
[ 'MooseX::AutoDestruct::Trait::Attribute' => 'AutoDestruct' ], |
54
|
|
|
|
|
|
|
[ 'MooseX::MultiInitArg::Trait' => 'MultiInitArg' ], |
55
|
|
|
|
|
|
|
[ 'MooseX::TrackDirty::Attributes::Trait::Attribute' => 'TrackDirty' ], |
56
|
|
|
|
|
|
|
[ 'MooseX::UndefTolerant::Attribute' => 'UndefTolerant' ], |
57
|
|
|
|
|
|
|
[ 'MooseX::CascadeClearing::Role::Meta::Attribute' => 'CascadeClearing' ], |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# these don't export a trait_alias, so let's create one |
60
|
|
|
|
|
|
|
'MooseX::LazyRequire::Meta::Attribute::Trait::LazyRequire', |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# this one is a little funky, in that it replaces the accessor |
63
|
|
|
|
|
|
|
# metaclass, rather than just applying a trait to it |
64
|
|
|
|
|
|
|
[ 'Moose::Meta::Attribute::Custom::Trait::MergeHashRef' => 'MergeHashRef' ], |
65
|
|
|
|
|
|
|
); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# If an extension doesn't have a trait that's directly loadable, we build subs |
69
|
|
|
|
|
|
|
# to do it here. |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
0
|
|
0
|
sub ENV { _lazy('MooseX::Attribute::ENV', 'MooseX::Attribute::ENV' ) } |
72
|
0
|
|
|
0
|
0
|
0
|
sub SetOnce { _lazy('MooseX::SetOnce', 'MooseX::SetOnce::Attribute' ) } |
73
|
0
|
|
|
0
|
0
|
0
|
sub Shortcuts { _lazy('MooseX::AttributeShortcuts', 'MooseX::AttributeShortcuts::Trait::Attribute') } |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
0
|
|
0
|
sub _lazy { load_class(shift); shift } |
|
0
|
|
|
|
|
0
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub as_is { |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
return ( |
81
|
17
|
|
|
17
|
1
|
133
|
\&ENV, |
82
|
|
|
|
|
|
|
\&SetOnce, |
83
|
|
|
|
|
|
|
\&Shortcuts, |
84
|
|
|
|
|
|
|
); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# Types: |
88
|
|
|
|
|
|
|
# Tied, Perl, IxHash, ENV |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# Roles: |
91
|
|
|
|
|
|
|
# TraitConstructor, Traits |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub also_list { |
95
|
|
|
|
|
|
|
|
96
|
18
|
|
|
18
|
1
|
132
|
return qw{ |
97
|
|
|
|
|
|
|
MooseX::AbstractMethod |
98
|
|
|
|
|
|
|
MooseX::AlwaysCoerce |
99
|
|
|
|
|
|
|
MooseX::AttributeShortcuts |
100
|
|
|
|
|
|
|
MooseX::ClassAttribute |
101
|
|
|
|
|
|
|
MooseX::CurriedDelegation |
102
|
|
|
|
|
|
|
MooseX::LazyRequire |
103
|
|
|
|
|
|
|
MooseX::NewDefaults |
104
|
|
|
|
|
|
|
MooseX::StrictConstructor |
105
|
|
|
|
|
|
|
}; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub import_type_libraries { |
110
|
77
|
|
|
77
|
1
|
246
|
my ($class, $opts) = @_; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
#$_->import({ -into => $opts->{for_class} }, ':all') |
113
|
|
|
|
|
|
|
$_->import($opts, ':all') |
114
|
77
|
|
|
|
|
219
|
for type_libraries(); |
115
|
|
|
|
|
|
|
|
116
|
77
|
|
|
|
|
1466911
|
return; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub type_libraries { |
121
|
|
|
|
|
|
|
|
122
|
79
|
|
|
79
|
1
|
675
|
return qw{ |
123
|
|
|
|
|
|
|
MooseX::Types::Moose |
124
|
|
|
|
|
|
|
MooseX::Types::Common::String |
125
|
|
|
|
|
|
|
MooseX::Types::Common::Numeric |
126
|
|
|
|
|
|
|
MooseX::Types::LoadableClass |
127
|
|
|
|
|
|
|
MooseX::Types::Path::Class |
128
|
|
|
|
|
|
|
MooseX::Types::Tied::Hash::IxHash |
129
|
|
|
|
|
|
|
}; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
!!42; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
__END__ |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=pod |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=encoding UTF-8 |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=for :stopwords Chris Weyl Alex Balhatchet |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 NAME |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Reindeer::Util - Common and utility functions for Reindeer |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 VERSION |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
This document describes version 0.019 of Reindeer::Util - released June 09, 2017 as part of Reindeer. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 SYNOPSIS |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 DESCRIPTION |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
This package provides the parts of Reindeer that are common to both Reindeer |
155
|
|
|
|
|
|
|
and Reindeer role. In general, this package contains functions that either |
156
|
|
|
|
|
|
|
return lists for L<Moose::Exporter> or actively import other packages into the |
157
|
|
|
|
|
|
|
namespace of packages invoking Reindeer or Reindeer::Role (e.g. type |
158
|
|
|
|
|
|
|
libraries). |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 FUNCTIONS |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head2 trait_aliases |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Trait alias definitions for our optional traits. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head2 as_is |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
A list of sugar to export "as_is". |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head2 also_list |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
A list of Moose::Exporter based packages that we should also invoke (through |
173
|
|
|
|
|
|
|
Moose::Exporter, that is). |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head2 import_type_libraries |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Import our list of type libraries into a given package. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head2 type_libraries |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Returns a list of type libraries currently exported by Reindeer. |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=for Pod::Coverage SetOnce |
184
|
|
|
|
|
|
|
Shortcuts |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head1 SEE ALSO |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Please see those modules/websites for more information related to this module. |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=over 4 |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=item * |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
L<Reindeer|Reindeer> |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=back |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head1 BUGS |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website |
201
|
|
|
|
|
|
|
L<https://github.com/RsrchBoy/reindeer/issues> |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
204
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
205
|
|
|
|
|
|
|
feature. |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=head1 AUTHOR |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
Chris Weyl <cweyl@alumni.drew.edu> |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
This software is Copyright (c) 2017, 2015, 2014, 2012, 2011 by Chris Weyl. |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
This is free software, licensed under: |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
The GNU Lesser General Public License, Version 2.1, February 1999 |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=cut |