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
|
|
2121
|
use 5.014; |
|
6
|
|
|
|
|
49
|
|
5
|
6
|
|
|
6
|
|
30
|
use strict; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
144
|
|
6
|
6
|
|
|
6
|
|
23
|
use warnings FATAL => 'all'; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
326
|
|
7
|
6
|
|
|
6
|
|
4015
|
use utf8 (); |
|
6
|
|
|
|
|
90
|
|
|
6
|
|
|
|
|
143
|
|
8
|
6
|
|
|
6
|
|
55
|
use feature (); |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
85
|
|
9
|
6
|
|
|
6
|
|
11434
|
use true (); |
|
6
|
|
|
|
|
73185
|
|
|
6
|
|
|
|
|
143
|
|
10
|
6
|
|
|
6
|
|
42
|
use Carp (); |
|
6
|
|
|
|
|
6
|
|
|
6
|
|
|
|
|
102
|
|
11
|
6
|
|
|
6
|
|
3257
|
use IO::Handle; |
|
6
|
|
|
|
|
38252
|
|
|
6
|
|
|
|
|
267
|
|
12
|
6
|
|
|
6
|
|
3579
|
use Try::Tiny (); |
|
6
|
|
|
|
|
13169
|
|
|
6
|
|
|
|
|
147
|
|
13
|
6
|
|
|
6
|
|
2970
|
use Hook::AfterRuntime; |
|
6
|
|
|
|
|
11413
|
|
|
6
|
|
|
|
|
322
|
|
14
|
6
|
|
|
6
|
|
3354
|
use Import::Into; |
|
6
|
|
|
|
|
16677
|
|
|
6
|
|
|
|
|
174
|
|
15
|
6
|
|
|
6
|
|
3374
|
use Data::OptList; |
|
6
|
|
|
|
|
48146
|
|
|
6
|
|
|
|
|
42
|
|
16
|
6
|
|
|
6
|
|
231
|
use Module::Runtime 'use_module'; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
33
|
|
17
|
6
|
|
|
6
|
|
3710
|
use namespace::autoclean; |
|
6
|
|
|
|
|
80760
|
|
|
6
|
|
|
|
|
19
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '0.24'; # VERSION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
BEGIN { |
22
|
|
|
|
|
|
|
$SIG{'__DIE__'} = sub { |
23
|
120
|
50
|
|
|
|
435560
|
if($^S) { |
24
|
0
|
|
|
|
|
0
|
return; |
25
|
|
|
|
|
|
|
} |
26
|
120
|
50
|
|
|
|
380
|
Carp::confess(@_) if $ENV{DEBUG}; |
27
|
120
|
|
|
|
|
1355
|
die(@_); |
28
|
6
|
|
|
6
|
|
1913
|
}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# To ensure STDERR will be utf8 encoded |
32
|
6
|
|
|
6
|
|
2966
|
binmode STDERR, ":encoding(utf8)"; |
|
6
|
|
|
|
|
82
|
|
|
6
|
|
|
|
|
42
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# Enable auto-flush |
35
|
|
|
|
|
|
|
STDERR->autoflush(1); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
our $LOG_VERBOSE = 1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub log_msg { |
40
|
152
|
|
|
152
|
0
|
497
|
my ($msg) = @_; |
41
|
152
|
50
|
|
|
|
363
|
return if not defined $msg; |
42
|
152
|
|
|
|
|
259
|
chomp $msg; |
43
|
152
|
50
|
|
|
|
432
|
say STDERR $msg if $LOG_VERBOSE; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub import { |
47
|
220
|
|
|
220
|
|
923356
|
my ($class, @opts) = @_; |
48
|
220
|
|
|
|
|
636
|
my $caller = caller; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# Import as in Moder::Perl |
51
|
220
|
|
|
|
|
1801
|
strict->import; |
52
|
220
|
|
|
|
|
15715
|
feature->import(':5.14'); |
53
|
220
|
|
|
|
|
1566
|
utf8->import($caller); |
54
|
220
|
|
|
|
|
1726
|
true->import; |
55
|
220
|
|
|
|
|
500491
|
Carp->import::into($caller); |
56
|
220
|
|
|
|
|
61547
|
Try::Tiny->import::into($caller); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# Custom handy function |
59
|
220
|
|
|
|
|
47209
|
do { |
60
|
6
|
|
|
6
|
|
42
|
no strict 'refs'; ## no critic |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
3408
|
|
61
|
220
|
|
|
|
|
751
|
*{"${caller}\:\:log_msg"} = \&log_msg; |
|
220
|
|
|
|
|
1136
|
|
62
|
220
|
|
|
|
|
480
|
*{"${caller}\:\:LOG_VERBOSE"} = \$LOG_VERBOSE; |
|
220
|
|
|
|
|
898
|
|
63
|
|
|
|
|
|
|
}; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
@opts = @{ |
66
|
220
|
|
|
|
|
454
|
Data::OptList::mkopt( |
|
220
|
|
|
|
|
825
|
|
67
|
|
|
|
|
|
|
\@opts, |
68
|
|
|
|
|
|
|
) |
69
|
|
|
|
|
|
|
}; |
70
|
|
|
|
|
|
|
|
71
|
220
|
|
|
|
|
7247
|
my @no_clean; |
72
|
220
|
|
|
|
|
534
|
for my $opt_spec (@opts) { |
73
|
213
|
|
|
|
|
528
|
my ($opt, $opt_args) = @$opt_spec; |
74
|
213
|
50
|
|
|
|
1092
|
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
|
108
|
|
|
|
|
4753
|
require Moose; |
82
|
108
|
|
|
|
|
2790803
|
require MooseX::StrictConstructor; |
83
|
108
|
|
|
|
|
138748
|
require MooseX::UndefTolerant; |
84
|
108
|
|
|
|
|
127853
|
require App::Sandy::Types; |
85
|
108
|
|
|
|
|
864
|
Moose->import({into=>$caller}); |
86
|
108
|
|
|
|
|
740071
|
MooseX::StrictConstructor->import({into=>$caller}); |
87
|
108
|
|
|
|
|
413658
|
MooseX::UndefTolerant->import({into=>$caller}); |
88
|
108
|
|
|
|
|
513097
|
App::Sandy::Types->import({into=>$caller}); |
89
|
|
|
|
|
|
|
after_runtime { |
90
|
108
|
|
|
108
|
|
27751
|
$caller->meta->make_immutable; |
91
|
|
|
|
|
|
|
} |
92
|
108
|
|
|
|
|
836
|
} elsif ($opt eq 'role') { |
93
|
45
|
|
|
|
|
306
|
require Moose::Role; |
94
|
45
|
|
|
|
|
175
|
require App::Sandy::Types; |
95
|
45
|
|
|
|
|
472
|
Moose::Role->import({into=>$caller}); |
96
|
45
|
|
|
|
|
250837
|
App::Sandy::Types->import({into=>$caller}); |
97
|
|
|
|
|
|
|
} elsif ($opt eq 'test') { |
98
|
60
|
|
|
|
|
190
|
use_module('Test::Most')->import::into($caller); |
99
|
60
|
100
|
|
|
|
372735
|
if ($opt_args) { |
100
|
10
|
|
|
|
|
90
|
for my $opt_arg (@$opt_args) { |
101
|
10
|
100
|
|
|
|
60
|
if ($opt_arg eq 'class_load') { |
|
|
50
|
|
|
|
|
|
102
|
5
|
|
|
|
|
25
|
use_module('Test::Class::Load')->import::into($caller, 't/lib'); |
103
|
|
|
|
|
|
|
} elsif ($opt_arg eq 'class_base') { |
104
|
5
|
|
|
|
|
25
|
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
|
220
|
|
|
|
|
56258
|
warnings->import('FATAL'=>'all'); |
119
|
|
|
|
|
|
|
|
120
|
220
|
|
|
|
|
1737
|
namespace::autoclean->import( |
121
|
|
|
|
|
|
|
-cleanee => $caller, |
122
|
|
|
|
|
|
|
-except => \@no_clean, |
123
|
|
|
|
|
|
|
); |
124
|
|
|
|
|
|
|
|
125
|
220
|
|
|
|
|
62474
|
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.24 |
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
|
|
|
|
|
|
|
Rodrigo Barreiro <rbarreiro@mochsl.org.br> |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item * |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Gabriela Guardia <gguardia@mochsl.org.br> |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item * |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Fernanda Orpinelli <forpinelli@mochsl.org.br> |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=item * |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Rafael Mercuri <rmercuri@mochsl.org.br> |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=item * |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Rodrigo Barreiro <rbarreiro@mochsl.org.br> |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=item * |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Pedro A. F. Galante <pgalante@mochsl.org.br> |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=back |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
This software is Copyright (c) 2023 by Teaching and Research Institute from Sírio-Libanês Hospital. |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
This is free software, licensed under: |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=cut |