| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Full::Script; |
|
2
|
3
|
|
|
3
|
|
231892
|
use Full::Pragmata qw(:v1); |
|
|
3
|
|
|
|
|
16
|
|
|
|
3
|
|
|
|
|
47
|
|
|
3
|
3
|
|
|
3
|
|
24
|
use parent qw(Full::Pragmata); |
|
|
3
|
|
|
|
|
2079
|
|
|
|
3
|
|
|
|
|
30
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.004'; # VERSION |
|
6
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TEAM'; # AUTHORITY |
|
7
|
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
615
|
use utf8; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
12
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=encoding utf8 |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Full::Script - common preƤmble for Perl scripts |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#!/usr/bin/env perl |
|
19
|
|
|
|
|
|
|
use Full::Script; |
|
20
|
|
|
|
|
|
|
$log->infof('Starting'); |
|
21
|
|
|
|
|
|
|
await $loop->delay_future(after => 1); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Loads common modules and applies language syntax and other features |
|
26
|
|
|
|
|
|
|
as described in L. |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
The intention is to use this as the first line in every script or cron job |
|
29
|
|
|
|
|
|
|
so that we have consistent configuration and language features. It also |
|
30
|
|
|
|
|
|
|
allows us to apply new standards across the entire codebase without having |
|
31
|
|
|
|
|
|
|
to modify the code itself. |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
|
34
|
|
|
|
|
|
|
|
|
35
|
3
|
|
|
3
|
|
2250
|
use Log::Any::Adapter; |
|
|
3
|
|
|
|
|
2026
|
|
|
|
3
|
|
|
|
|
49
|
|
|
36
|
3
|
|
|
3
|
|
2091
|
use Time::Moment; |
|
|
3
|
|
|
|
|
11590
|
|
|
|
3
|
|
|
|
|
220
|
|
|
37
|
3
|
|
|
3
|
|
2008
|
use Time::Moment::Role::Strptime; |
|
|
3
|
|
|
|
|
120917
|
|
|
|
3
|
|
|
|
|
273
|
|
|
38
|
3
|
|
|
3
|
|
2147
|
use Time::Moment::Role::TimeZone; |
|
|
3
|
|
|
|
|
4288
|
|
|
|
3
|
|
|
|
|
270
|
|
|
39
|
3
|
|
|
3
|
|
26
|
use Time::Moment; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
141
|
|
|
40
|
3
|
|
|
3
|
|
17
|
use Role::Tiny; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
18
|
|
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# Extend Time::Moment to include ->strptime and some basic timezone support. |
|
43
|
|
|
|
|
|
|
Role::Tiny->apply_roles_to_package('Time::Moment', qw( |
|
44
|
|
|
|
|
|
|
Time::Moment::Role::Strptime |
|
45
|
|
|
|
|
|
|
Time::Moment::Role::TimeZone |
|
46
|
|
|
|
|
|
|
)); |
|
47
|
|
|
|
|
|
|
|
|
48
|
2
|
|
|
2
|
|
25
|
sub import ($called_on, $version, %args) { |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
3
|
|
|
49
|
2
|
|
33
|
|
|
16
|
my $pkg = $args{target} // caller(0); |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# Ensure we have a sensible encoding layer - scripts that expect |
|
52
|
|
|
|
|
|
|
# to work with binary data would need to remove this layer (and if |
|
53
|
|
|
|
|
|
|
# we do that often, we'll add an option for it). |
|
54
|
2
|
|
|
2
|
|
76
|
binmode STDOUT, ':encoding(UTF-8)'; |
|
|
2
|
|
|
|
|
2674
|
|
|
|
2
|
|
|
|
|
62
|
|
|
|
2
|
|
|
|
|
14
|
|
|
55
|
2
|
|
|
|
|
63521
|
binmode STDERR, ':encoding(UTF-8)'; |
|
56
|
2
|
|
|
|
|
121
|
binmode STDIN, ':encoding(UTF-8)'; |
|
57
|
2
|
|
|
|
|
319
|
STDOUT->autoflush(1); |
|
58
|
|
|
|
|
|
|
|
|
59
|
2
|
|
50
|
|
|
25876
|
Log::Any::Adapter->import('Stderr', log_level => $ENV{LOG_LEVEL} // 'info'); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# Apply pragmata |
|
62
|
2
|
|
|
|
|
4494
|
return $called_on->next::method( |
|
63
|
|
|
|
|
|
|
$version, |
|
64
|
|
|
|
|
|
|
%args, |
|
65
|
|
|
|
|
|
|
target => $pkg, |
|
66
|
|
|
|
|
|
|
); |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__END__ |