lib/HTML/FormFu/Upload.pm

filter: Statementstmt 100% 35 / 35 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 1 totaltotal 94.0% 47 / 50 SCAR 13.9
CC
4
Cov
95%
_param
3.0
slurp
2.0
BEGIN
1.0
CRAP 4.0
« lib/HTML/FormFu/Constraint/Number.pm ↑ Summary lib/HTML/FormFu/Element/ContentButton.pm »
1 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 package HTML::FormFu::Upload;
4 8 $HTML::FormFu::Upload::VERSION = '2.06';
5 # ABSTRACT: uploaded file
6  
7 8 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 8 ▶use MooseX::Attribute::Chained;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 8 with 'HTML::FormFu::Role::Populate';
11  
12 8 ▶use HTML::FormFu::ObjectUtil qw( form parent );
Subroutine BEGIN: called CC=1 SCAR=0.0
13 8 ▶use HTML::FormFu::UploadParam;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 8 has headers => ( is => 'rw', traits => ['Chained'] );
16 8 has filename => ( is => 'rw', traits => ['Chained'] );
17 8 has size => ( is => 'rw', traits => ['Chained'] );
18 8 has type => ( is => 'rw', traits => ['Chained'] );
19  
20 ▶sub BUILD { }
Subroutine BUILD: called CC=1 SCAR=0.0
21  
22 sub _param {
23 23 ▶ my ( $self, $param ) = @_;
Subroutine _param: called CC=3 SCAR=11.0
24  
25 23 ▶ if ( @_ > 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ > 1) 18 5 23
26 18 $param = HTML::FormFu::UploadParam->new( { param => $param, } );
27  
28 18 $param->form( $self->form );
29  
30 18 $self->{_param} = $param;
31 }
32  
33 23 ▶ return defined $self->{_param} ? $self->{_param}->param : ();
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{'_param'} ? : 23 0 23
34 }
35  
36 sub slurp {
37 5 ▶ my ($self) = @_;
Subroutine slurp: called CC=2 SCAR=7.0
Pod undocumented
38  
39 5 my $fh = $self->fh;
40  
41 5 ▶ return if !defined $fh;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $fh 0 5 5
42  
43 5 binmode $fh;
44  
45 5 local $/;
46  
47 5 return <$fh>;
48 }
49  
50 8 __PACKAGE__->meta->make_immutable;
51  
52 8 1;
53  
54 __END__
55  
56 =pod
57  
58 =encoding UTF-8
59  
60 =head1 NAME
61  
62 HTML::FormFu::Upload - uploaded file
63  
64 =head1 VERSION
65  
66 version 2.06
67  
68 =head1 DESCRIPTION
69  
70 An instance is created for each uploaded file.
71  
72 You will normally get an object of one of the following classes, which inherit
73 from L<HTML::FormFu::Upload>:
74  
75 =over
76  
77 =item L<HTML::FormFu::QueryType::CGI>
78  
79 =item L<HTML::FormFu::QueryType::Catalyst>
80  
81 =item L<HTML::FormFu::QueryType::CGI::Simple>
82  
83 =back
84  
85 =head1 METHODS
86  
87 =head2 parent
88  
89 Returns the L<field|HTML::FormFu::Role::Element::Field> object that the upload
90 object is associated with.
91  
92 =head2 form
93  
94 Returns the L<HTML::FormFu> object that the upload object's field is attached
95 to.
96  
97 =head2 populate
98  
99 See L<HTML::FormFu/populate> for details.
100  
101 =head1 SEE ALSO
102  
103 L<HTML::FormFu>
104  
105 =head1 AUTHOR
106  
107 Carl Franks, C<cfranks@cpan.org>
108  
109 =head1 LICENSE
110  
111 This library is free software, you can redistribute it and/or modify it under
112 the same terms as Perl itself.
113  
114 =head1 AUTHOR
115  
116 Carl Franks <cpan@fireartist.com>
117  
118 =head1 COPYRIGHT AND LICENSE
119  
120 This software is copyright (c) 2018 by Carl Franks.
121  
122 This is free software; you can redistribute it and/or modify it under
123 the same terms as the Perl 5 programming language system itself.
124  
125 =cut
« lib/HTML/FormFu/Constraint/Number.pm ↑ Summary lib/HTML/FormFu/Element/ContentButton.pm »