| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Astro::App::Satpass2::Format::Template::Provider; |
|
2
|
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
266
|
use 5.008; |
|
|
8
|
|
|
|
|
34
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
8
|
|
|
8
|
|
43
|
use strict; |
|
|
8
|
|
|
|
|
179
|
|
|
|
8
|
|
|
|
|
397
|
|
|
6
|
8
|
|
|
8
|
|
48
|
use warnings; |
|
|
8
|
|
|
|
|
15
|
|
|
|
8
|
|
|
|
|
551
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
8
|
|
|
8
|
|
164
|
use parent qw{ Template::Provider }; |
|
|
8
|
|
|
|
|
15
|
|
|
|
8
|
|
|
|
|
58
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
8
|
|
|
8
|
|
117507
|
use Astro::App::Satpass2::Utils qw{ :os @CARP_NOT }; |
|
|
8
|
|
|
|
|
21
|
|
|
|
8
|
|
|
|
|
1396
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.057_01'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
8
|
|
|
|
|
2189
|
use constant ENCODING => OS_IS_WINDOWS ? |
|
15
|
|
|
|
|
|
|
':crlf:encoding(utf-8)' : |
|
16
|
8
|
|
|
8
|
|
57
|
':encoding(utf-8)'; |
|
|
8
|
|
|
|
|
18
|
|
|
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
|
|
418
|
my ($self, $path) = @_; |
|
25
|
|
|
|
|
|
|
|
|
26
|
2
|
50
|
|
|
|
8
|
return (undef, "No path specified to fetch content from ") |
|
27
|
|
|
|
|
|
|
unless $path; |
|
28
|
|
|
|
|
|
|
|
|
29
|
2
|
|
|
|
|
5
|
my $data; |
|
30
|
|
|
|
|
|
|
my $mod_date; |
|
31
|
2
|
|
|
|
|
0
|
my $error; |
|
32
|
|
|
|
|
|
|
|
|
33
|
2
|
|
|
|
|
6
|
local *FH; |
|
34
|
2
|
50
|
|
|
|
97
|
if(-d $path) { |
|
|
|
50
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
0
|
$error = "$path: not a file"; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
elsif (open(FH, "<", $path)) { |
|
38
|
2
|
|
|
|
|
14
|
local $/; |
|
39
|
2
|
|
|
1
|
|
40
|
binmode(FH, ENCODING); |
|
|
1
|
|
|
|
|
662
|
|
|
|
1
|
|
|
|
|
14
|
|
|
|
1
|
|
|
|
|
4
|
|
|
40
|
2
|
|
|
|
|
1143
|
$data = ; |
|
41
|
2
|
|
|
|
|
47
|
$mod_date = (stat($path))[9]; |
|
42
|
2
|
|
|
|
|
42
|
close(FH); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
else { |
|
45
|
0
|
|
|
|
|
0
|
$error = "$path: $!"; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
return wantarray |
|
49
|
2
|
50
|
|
|
|
16
|
? ( $data, $error, $mod_date ) |
|
50
|
|
|
|
|
|
|
: $data; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
## use critic |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |