line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SparkX::Form::Field::File; |
2
|
|
|
|
|
|
|
our $VERSION = '0.2102'; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# ABSTRACT: A File upload field for SparkX::Form |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
547
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
8
|
1
|
|
|
1
|
|
5039
|
use HTML::Tiny; |
|
1
|
|
|
|
|
1934
|
|
|
1
|
|
|
|
|
139
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
extends 'Spark::Form::Field'; |
11
|
|
|
|
|
|
|
with 'Spark::Form::Field::Role::Printable::HTML', |
12
|
|
|
|
|
|
|
'Spark::Form::Field::Role::Printable::XHTML'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has '+value' => ( |
15
|
|
|
|
|
|
|
isa => 'Str', |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub to_html { |
19
|
0
|
|
|
0
|
1
|
0
|
return shift->_render(HTML::Tiny->new(mode => 'html')); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub to_xhtml { |
23
|
1
|
|
|
1
|
1
|
35
|
return shift->_render(HTML::Tiny->new(mode => 'xml')); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _render { |
27
|
1
|
|
|
1
|
|
54
|
my ($self, $html) = @_; |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
33
|
return $html->input({type => 'file', name => $self->name}); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=pod |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 NAME |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
SparkX::Form::Field::File - A File upload field for SparkX::Form |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 VERSION |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
version 0.2102 |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 METHODS |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 to_html() => Str |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Renders the field to HTML |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 to_xhtml() => Str |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Renders the field to XHTML |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 validate() => Bool |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Validates the field. Before composition with validators, always returns 1. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 SEE ALSO |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=over 4 |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item L<SparkX::Form> - The forms module this is to be used with |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item L<SparkX::Form::BasicFields> - A collection of fields for use with C<Spark::Form> |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=back |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 AUTHOR |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
James Laver L<http://jameslaver.com> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This software is copyright (c) 2009 by James Laver C<< <sprintf qw(%s@%s.%s cpan jameslaver com)> >>. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
81
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
__END__ |
88
|
|
|
|
|
|
|
|