line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Statocles::Page::File; |
2
|
|
|
|
|
|
|
our $VERSION = '0.084'; |
3
|
|
|
|
|
|
|
# ABSTRACT: A page wrapping a file (handle) |
4
|
|
|
|
|
|
|
|
5
|
59
|
|
|
59
|
|
1103
|
use Statocles::Base 'Class'; |
|
59
|
|
|
|
|
126
|
|
|
59
|
|
|
|
|
487
|
|
6
|
|
|
|
|
|
|
with 'Statocles::Page'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#pod =attr file_path |
9
|
|
|
|
|
|
|
#pod |
10
|
|
|
|
|
|
|
#pod The path to the file. |
11
|
|
|
|
|
|
|
#pod |
12
|
|
|
|
|
|
|
#pod =cut |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has file_path => ( |
15
|
|
|
|
|
|
|
is => 'ro', |
16
|
|
|
|
|
|
|
isa => Path, |
17
|
|
|
|
|
|
|
coerce => Path->coercion, |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#pod =attr fh |
21
|
|
|
|
|
|
|
#pod |
22
|
|
|
|
|
|
|
#pod The file handle containing the contents of the page. |
23
|
|
|
|
|
|
|
#pod |
24
|
|
|
|
|
|
|
#pod =cut |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has fh => ( |
27
|
|
|
|
|
|
|
is => 'ro', |
28
|
|
|
|
|
|
|
isa => FileHandle, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
#pod =method vars |
32
|
|
|
|
|
|
|
#pod |
33
|
|
|
|
|
|
|
#pod Dies. This page has no templates and no template variables. |
34
|
|
|
|
|
|
|
#pod |
35
|
|
|
|
|
|
|
#pod =cut |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# XXX: This may have to be implemented in the future, to allow for some useful edge |
38
|
|
|
|
|
|
|
# cases. |
39
|
0
|
|
|
0
|
1
|
0
|
sub vars { die "Unimplemented" } |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
#pod =method render |
42
|
|
|
|
|
|
|
#pod |
43
|
|
|
|
|
|
|
#pod my $fh = $page->render; |
44
|
|
|
|
|
|
|
#pod |
45
|
|
|
|
|
|
|
#pod Return the filehandle to the file containing the content for this page. |
46
|
|
|
|
|
|
|
#pod |
47
|
|
|
|
|
|
|
#pod =cut |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub render { |
50
|
492
|
|
|
492
|
1
|
52963
|
my ( $self ) = @_; |
51
|
492
|
|
|
|
|
10020
|
$self->site->log->debug( 'Render page: ' . $self->path ); |
52
|
492
|
100
|
|
|
|
44715
|
return $self->file_path ? $self->file_path : $self->fh; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=pod |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=encoding UTF-8 |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 NAME |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Statocles::Page::File - A page wrapping a file (handle) |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 VERSION |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
version 0.084 |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 SYNOPSIS |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# File path |
74
|
|
|
|
|
|
|
my $page = Statocles::Page::File->new( |
75
|
|
|
|
|
|
|
path => '/path/to/page.txt', |
76
|
|
|
|
|
|
|
file_path => '/path/to/file.txt', |
77
|
|
|
|
|
|
|
); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# Filehandle |
80
|
|
|
|
|
|
|
open my $fh, '<', '/path/to/file.txt'; |
81
|
|
|
|
|
|
|
my $page = Statocles::Page::File->new( |
82
|
|
|
|
|
|
|
path => '/path/to/page.txt', |
83
|
|
|
|
|
|
|
fh => $fh, |
84
|
|
|
|
|
|
|
); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 DESCRIPTION |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This L<Statocles::Page> wraps a file handle in order to move files from one |
89
|
|
|
|
|
|
|
L<store|Statocles::Store> to another. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head2 file_path |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
The path to the file. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head2 fh |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
The file handle containing the contents of the page. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 METHODS |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head2 vars |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Dies. This page has no templates and no template variables. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head2 render |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
my $fh = $page->render; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Return the filehandle to the file containing the content for this page. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 AUTHOR |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Doug Bell <preaction@cpan.org> |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
This software is copyright (c) 2016 by Doug Bell. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
122
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=cut |