| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Astro::App::Satpass2::Format::Template::Provider; |
|
2
|
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
143
|
use 5.008; |
|
|
8
|
|
|
|
|
131
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
8
|
|
|
8
|
|
33
|
use strict; |
|
|
8
|
|
|
|
|
391
|
|
|
|
8
|
|
|
|
|
240
|
|
|
6
|
8
|
|
|
8
|
|
30
|
use warnings; |
|
|
8
|
|
|
|
|
10
|
|
|
|
8
|
|
|
|
|
314
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
8
|
|
|
8
|
|
41
|
use parent qw{ Template::Provider }; |
|
|
8
|
|
|
|
|
14
|
|
|
|
8
|
|
|
|
|
46
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
8
|
|
|
8
|
|
86065
|
use Astro::App::Satpass2::Utils qw{ :os @CARP_NOT }; |
|
|
8
|
|
|
|
|
15
|
|
|
|
8
|
|
|
|
|
1063
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.058'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
8
|
|
|
|
|
1502
|
use constant ENCODING => OS_IS_WINDOWS ? |
|
15
|
|
|
|
|
|
|
':crlf:encoding(utf-8)' : |
|
16
|
8
|
|
|
8
|
|
41
|
':encoding(utf-8)'; |
|
|
8
|
|
|
|
|
37
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Cribbed **ALMOST** verbatim from Template::Provider. The only |
|
19
|
|
|
|
|
|
|
# difference is the binmode() call, which applies I/O layers as |
|
20
|
|
|
|
|
|
|
# convenient. |
|
21
|
|
|
|
|
|
|
## no critic (UnusedPrivateSubroutines,UnusedVarsStricter,ProhibitBarewordFileHandles,ProhibitInterpolationOfLiterals) |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _template_content { |
|
24
|
2
|
|
|
2
|
|
340
|
my ($self, $path) = @_; |
|
25
|
|
|
|
|
|
|
|
|
26
|
2
|
50
|
|
|
|
6
|
return (undef, "No path specified to fetch content from ") |
|
27
|
|
|
|
|
|
|
unless $path; |
|
28
|
|
|
|
|
|
|
|
|
29
|
2
|
|
|
|
|
7
|
my $data; |
|
30
|
|
|
|
|
|
|
my $mod_date; |
|
31
|
2
|
|
|
|
|
0
|
my $error; |
|
32
|
|
|
|
|
|
|
|
|
33
|
2
|
|
|
|
|
5
|
local *FH; |
|
34
|
2
|
50
|
|
|
|
86
|
if(-d $path) { |
|
|
|
50
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
0
|
$error = "$path: not a file"; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
elsif (open(FH, "<", $path)) { |
|
38
|
2
|
|
|
|
|
12
|
local $/; |
|
39
|
2
|
|
|
1
|
|
40
|
binmode(FH, ENCODING); |
|
|
1
|
|
|
|
|
578
|
|
|
|
1
|
|
|
|
|
14
|
|
|
|
1
|
|
|
|
|
4
|
|
|
40
|
2
|
|
|
|
|
1065
|
$data = ; |
|
41
|
2
|
|
|
|
|
75
|
$mod_date = (stat($path))[9]; |
|
42
|
2
|
|
|
|
|
35
|
close(FH); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
else { |
|
45
|
0
|
|
|
|
|
0
|
$error = "$path: $!"; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
return wantarray |
|
49
|
2
|
50
|
|
|
|
17
|
? ( $data, $error, $mod_date ) |
|
50
|
|
|
|
|
|
|
: $data; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
## use critic |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |