line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Sandy::Base; |
2
|
|
|
|
|
|
|
# ABSTRACT: Policy and base module to App::Sandy project. |
3
|
|
|
|
|
|
|
|
4
|
6
|
|
|
6
|
|
1948
|
use 5.014; |
|
6
|
|
|
|
|
54
|
|
5
|
6
|
|
|
6
|
|
29
|
use strict; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
138
|
|
6
|
6
|
|
|
6
|
|
29
|
use warnings FATAL => 'all'; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
250
|
|
7
|
6
|
|
|
6
|
|
3285
|
use utf8 (); |
|
6
|
|
|
|
|
89
|
|
|
6
|
|
|
|
|
218
|
|
8
|
6
|
|
|
6
|
|
36
|
use feature (); |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
288
|
|
9
|
6
|
|
|
6
|
|
2403
|
use true (); |
|
6
|
|
|
|
|
58675
|
|
|
6
|
|
|
|
|
139
|
|
10
|
6
|
|
|
6
|
|
40
|
use Carp (); |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
101
|
|
11
|
6
|
|
|
6
|
|
3069
|
use IO::Handle; |
|
6
|
|
|
|
|
35486
|
|
|
6
|
|
|
|
|
262
|
|
12
|
6
|
|
|
6
|
|
2814
|
use Try::Tiny (); |
|
6
|
|
|
|
|
11913
|
|
|
6
|
|
|
|
|
146
|
|
13
|
6
|
|
|
6
|
|
2787
|
use Hook::AfterRuntime; |
|
6
|
|
|
|
|
9028
|
|
|
6
|
|
|
|
|
295
|
|
14
|
6
|
|
|
6
|
|
2486
|
use Import::Into; |
|
6
|
|
|
|
|
17292
|
|
|
6
|
|
|
|
|
173
|
|
15
|
6
|
|
|
6
|
|
2518
|
use Data::OptList; |
|
6
|
|
|
|
|
35113
|
|
|
6
|
|
|
|
|
37
|
|
16
|
6
|
|
|
6
|
|
209
|
use Module::Runtime 'use_module'; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
30
|
|
17
|
6
|
|
|
6
|
|
2840
|
use namespace::autoclean; |
|
6
|
|
|
|
|
76203
|
|
|
6
|
|
|
|
|
19
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '0.22'; # VERSION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
BEGIN { |
22
|
|
|
|
|
|
|
$SIG{'__DIE__'} = sub { |
23
|
110
|
50
|
|
|
|
393235
|
if($^S) { |
24
|
0
|
|
|
|
|
0
|
return; |
25
|
|
|
|
|
|
|
} |
26
|
110
|
50
|
|
|
|
430
|
Carp::confess(@_) if $ENV{DEBUG}; |
27
|
110
|
|
|
|
|
1250
|
die(@_); |
28
|
6
|
|
|
6
|
|
1765
|
}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# To ensure STDERR will be utf8 encoded |
32
|
6
|
|
|
6
|
|
2851
|
binmode STDERR, ":encoding(utf8)"; |
|
6
|
|
|
|
|
76
|
|
|
6
|
|
|
|
|
31
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# Enable auto-flush |
35
|
|
|
|
|
|
|
STDERR->autoflush(1); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
our $LOG_VERBOSE = 1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub log_msg { |
40
|
132
|
|
|
132
|
0
|
402
|
my ($msg) = @_; |
41
|
132
|
50
|
|
|
|
2072
|
return if not defined $msg; |
42
|
132
|
|
|
|
|
303
|
chomp $msg; |
43
|
132
|
50
|
|
|
|
377
|
say STDERR $msg if $LOG_VERBOSE; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub import { |
47
|
231
|
|
|
231
|
|
841754
|
my ($class, @opts) = @_; |
48
|
231
|
|
|
|
|
713
|
my $caller = caller; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# Import as in Moder::Perl |
51
|
231
|
|
|
|
|
2068
|
strict->import; |
52
|
231
|
|
|
|
|
17358
|
feature->import(':5.14'); |
53
|
231
|
|
|
|
|
1725
|
utf8->import($caller); |
54
|
231
|
|
|
|
|
2286
|
true->import; |
55
|
231
|
|
|
|
|
515940
|
Carp->import::into($caller); |
56
|
231
|
|
|
|
|
66061
|
Try::Tiny->import::into($caller); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# Custom handy function |
59
|
231
|
|
|
|
|
49833
|
do { |
60
|
6
|
|
|
6
|
|
61
|
no strict 'refs'; ## no critic |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
3002
|
|
61
|
231
|
|
|
|
|
721
|
*{"${caller}\:\:log_msg"} = \&log_msg; |
|
231
|
|
|
|
|
1164
|
|
62
|
231
|
|
|
|
|
546
|
*{"${caller}\:\:LOG_VERBOSE"} = \$LOG_VERBOSE; |
|
231
|
|
|
|
|
1079
|
|
63
|
|
|
|
|
|
|
}; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
@opts = @{ |
66
|
231
|
|
|
|
|
451
|
Data::OptList::mkopt( |
|
231
|
|
|
|
|
1023
|
|
67
|
|
|
|
|
|
|
\@opts, |
68
|
|
|
|
|
|
|
) |
69
|
|
|
|
|
|
|
}; |
70
|
|
|
|
|
|
|
|
71
|
231
|
|
|
|
|
8041
|
my @no_clean; |
72
|
231
|
|
|
|
|
630
|
for my $opt_spec (@opts) { |
73
|
224
|
|
|
|
|
744
|
my ($opt, $opt_args) = @$opt_spec; |
74
|
224
|
50
|
|
|
|
1148
|
if ($opt eq 'dont_clean') { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
75
|
0
|
0
|
|
|
|
0
|
if (!$opt_args) { |
76
|
0
|
|
|
|
|
0
|
Carp::carp "ignoring dont_clean option without arrayref of subroutine names to keep"; |
77
|
0
|
|
|
|
|
0
|
next; |
78
|
|
|
|
|
|
|
} |
79
|
0
|
|
|
|
|
0
|
push @no_clean, @$opt_args; |
80
|
|
|
|
|
|
|
} elsif ($opt eq 'class') { |
81
|
113
|
|
|
|
|
3916
|
require Moose; |
82
|
113
|
|
|
|
|
2775830
|
require MooseX::StrictConstructor; |
83
|
113
|
|
|
|
|
138418
|
require MooseX::UndefTolerant; |
84
|
113
|
|
|
|
|
131071
|
require App::Sandy::Types; |
85
|
113
|
|
|
|
|
948
|
Moose->import({into=>$caller}); |
86
|
113
|
|
|
|
|
786900
|
MooseX::StrictConstructor->import({into=>$caller}); |
87
|
113
|
|
|
|
|
441594
|
MooseX::UndefTolerant->import({into=>$caller}); |
88
|
113
|
|
|
|
|
549424
|
App::Sandy::Types->import({into=>$caller}); |
89
|
|
|
|
|
|
|
after_runtime { |
90
|
113
|
|
|
113
|
|
26795
|
$caller->meta->make_immutable; |
91
|
|
|
|
|
|
|
} |
92
|
113
|
|
|
|
|
928
|
} elsif ($opt eq 'role') { |
93
|
56
|
|
|
|
|
333
|
require Moose::Role; |
94
|
56
|
|
|
|
|
232
|
require App::Sandy::Types; |
95
|
56
|
|
|
|
|
506
|
Moose::Role->import({into=>$caller}); |
96
|
56
|
|
|
|
|
302024
|
App::Sandy::Types->import({into=>$caller}); |
97
|
|
|
|
|
|
|
} elsif ($opt eq 'test') { |
98
|
55
|
|
|
|
|
195
|
use_module('Test::Most')->import::into($caller); |
99
|
55
|
100
|
|
|
|
275275
|
if ($opt_args) { |
100
|
10
|
|
|
|
|
40
|
for my $opt_arg (@$opt_args) { |
101
|
10
|
100
|
|
|
|
50
|
if ($opt_arg eq 'class_load') { |
|
|
50
|
|
|
|
|
|
102
|
5
|
|
|
|
|
30
|
use_module('Test::Class::Load')->import::into($caller, 't/lib'); |
103
|
|
|
|
|
|
|
} elsif ($opt_arg eq 'class_base') { |
104
|
5
|
|
|
|
|
15
|
my @classes = qw(Test::Class Class::Data::Inheritable); |
105
|
5
|
|
|
|
|
20
|
use_module('base')->import::into($caller, @classes); |
106
|
|
|
|
|
|
|
} else { |
107
|
0
|
|
|
|
|
0
|
Carp::carp "Ignoring unknown test option '$_'"; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
} else { |
112
|
0
|
|
|
|
|
0
|
Carp::carp "Ignoring unknown import option '$_'"; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
#This must come after anything else that might change warning |
117
|
|
|
|
|
|
|
# levels in the caller (e.g. Moose) |
118
|
231
|
|
|
|
|
61626
|
warnings->import('FATAL'=>'all'); |
119
|
|
|
|
|
|
|
|
120
|
231
|
|
|
|
|
2191
|
namespace::autoclean->import( |
121
|
|
|
|
|
|
|
-cleanee => $caller, |
122
|
|
|
|
|
|
|
-except => \@no_clean, |
123
|
|
|
|
|
|
|
); |
124
|
|
|
|
|
|
|
|
125
|
231
|
|
|
|
|
58463
|
return; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
1; ## --- end module App::Sandy::Base |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
__END__ |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=pod |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=encoding UTF-8 |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 NAME |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
App::Sandy::Base - Policy and base module to App::Sandy project. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 VERSION |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
version 0.22 |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 AUTHORS |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=over 4 |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=item * |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Thiago L. A. Miller <tmiller@mochsl.org.br> |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item * |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
J. Leonel Buzzo <lbuzzo@mochsl.org.br> |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=item * |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Felipe R. C. dos Santos <fsantos@mochsl.org.br> |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=item * |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Helena B. Conceição <hconceicao@mochsl.org.br> |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=item * |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Gabriela Guardia <gguardia@mochsl.org.br> |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item * |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Fernanda Orpinelli <forpinelli@mochsl.org.br> |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item * |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Pedro A. F. Galante <pgalante@mochsl.org.br> |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=back |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
This software is Copyright (c) 2018 by Teaching and Research Institute from SÃrio-Libanês Hospital. |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
This is free software, licensed under: |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=cut |