File Coverage

blib/lib/Articulate/File.pm
Criterion Covered Total %
statement 12 16 75.0
branch n/a
condition n/a
subroutine 4 6 66.6
pod n/a
total 16 22 72.7


line stmt bran cond sub pod time code
1             package Articulate::File;
2 11     11   47 use strict;
  11         15  
  11         351  
3 11     11   44 use warnings;
  11         17  
  11         228  
4 11     11   37 use Moo;
  11         16  
  11         56  
5 11     11   2879 use overload '""' => sub { shift->_to_string };
  11     0   16  
  11         85  
  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;