line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pod::ProjectDocs::File; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
2323
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
121
|
|
4
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
4
|
|
|
|
|
27
|
|
|
4
|
|
|
|
|
159
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.53'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
1742
|
use Moose::Role; |
|
4
|
|
|
|
|
18471
|
|
|
4
|
|
|
|
|
14
|
|
9
|
4
|
|
|
4
|
|
20644
|
use IO::File; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
510
|
|
10
|
4
|
|
|
4
|
|
26
|
use Carp(); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
1332
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has 'data' => ( is => 'ro', ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has 'default_name' => ( |
15
|
|
|
|
|
|
|
is => 'ro', |
16
|
|
|
|
|
|
|
isa => 'Str', |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has 'is_bin' => ( |
20
|
|
|
|
|
|
|
is => 'rw', |
21
|
|
|
|
|
|
|
default => 0, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has 'config' => ( is => 'ro', ); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has 'name' => ( |
27
|
|
|
|
|
|
|
is => 'rw', |
28
|
|
|
|
|
|
|
isa => 'Str', |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
has 'relpath' => ( |
32
|
|
|
|
|
|
|
is => 'rw', |
33
|
|
|
|
|
|
|
isa => 'Str', |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub _get_data { |
37
|
3
|
|
|
3
|
|
6
|
my $self = shift; |
38
|
3
|
|
|
|
|
92
|
return $self->data; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub publish { |
42
|
11
|
|
|
11
|
0
|
35
|
my ( $self, $data ) = @_; |
43
|
11
|
|
66
|
|
|
65
|
$data ||= $self->_get_data(); |
44
|
11
|
|
|
|
|
37
|
my $path = $self->get_output_path; |
45
|
11
|
|
|
|
|
25
|
my $mode = ">>"; |
46
|
11
|
100
|
|
|
|
53
|
if ( $path =~ m/html$/ ) { |
47
|
8
|
|
|
|
|
26
|
$mode .= ':encoding(UTF-8)'; |
48
|
|
|
|
|
|
|
} |
49
|
11
|
50
|
|
|
|
83
|
my $fh = IO::File->new( $path, $mode ) |
50
|
|
|
|
|
|
|
or Carp::croak(qq/Can't open $path./); |
51
|
11
|
|
|
|
|
34602
|
$fh->seek( 0, 0 ); |
52
|
11
|
|
|
|
|
206
|
$fh->truncate(0); |
53
|
11
|
|
|
|
|
424
|
$fh->print($data); |
54
|
11
|
|
|
|
|
609
|
$fh->close; |
55
|
11
|
|
|
|
|
1277
|
return; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub get_output_path { |
59
|
45
|
|
|
45
|
0
|
81
|
my $self = shift; |
60
|
45
|
|
|
|
|
1230
|
my $outroot = $self->config->outroot; |
61
|
45
|
|
66
|
|
|
1095
|
my $relpath = $self->relpath || $self->default_name; |
62
|
45
|
|
|
|
|
446
|
my $path = File::Spec->catfile( $outroot, $relpath ); |
63
|
45
|
|
|
|
|
1596
|
return $path; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
4
|
|
|
4
|
|
29
|
no Moose::Role; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
20
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
69
|
|
|
|
|
|
|
__END__ |