| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Articulate::File; |
|
2
|
10
|
|
|
10
|
|
47
|
use strict; |
|
|
10
|
|
|
|
|
13
|
|
|
|
10
|
|
|
|
|
390
|
|
|
3
|
10
|
|
|
10
|
|
48
|
use warnings; |
|
|
10
|
|
|
|
|
16
|
|
|
|
10
|
|
|
|
|
244
|
|
|
4
|
10
|
|
|
10
|
|
40
|
use Moo; |
|
|
10
|
|
|
|
|
50
|
|
|
|
10
|
|
|
|
|
55
|
|
|
5
|
10
|
|
|
10
|
|
2551
|
use overload '""' => sub { shift->_to_string }; |
|
|
10
|
|
|
0
|
|
15
|
|
|
|
10
|
|
|
|
|
98
|
|
|
|
0
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Articulate::File - represent a file |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
This represents a binary blob of content which is uploaded as a file |
|
16
|
|
|
|
|
|
|
and should ideally be moved straight into the database rather than |
|
17
|
|
|
|
|
|
|
loaded into memory. |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
It may also in future be used to represent files on the way out. The |
|
20
|
|
|
|
|
|
|
interface is currently unstable as it is largely copied from Dancer's |
|
21
|
|
|
|
|
|
|
file handling and is written to 'what works'. |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head3 content_type |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
The MIME type of the content. |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
has content_type => ( is => 'rw', ); |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head3 headers |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
The HTTP headers which came with the file. |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
has headers => ( is => 'rw', ); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head3 filename |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
The name of the file. |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=cut |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
has filename => ( is => 'rw', ); |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head3 io |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
The IO::All object which corresponds to the file handle. |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
has io => ( is => 'rw', ); |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub _to_string { |
|
60
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
61
|
0
|
|
|
|
|
|
local $/; |
|
62
|
0
|
|
|
|
|
|
join '', $self->io->getlines; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |