line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
1097
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
115
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package HTML::FormFu::Deflator::PathClassFile; |
4
|
|
|
|
|
|
|
$HTML::FormFu::Deflator::PathClassFile::VERSION = '2.07'; |
5
|
|
|
|
|
|
|
# ABSTRACT: Deflator for Path::Class::File objects |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
12
|
use Moose; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
13
|
|
8
|
2
|
|
|
2
|
|
12624
|
use MooseX::Attribute::Chained; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
490
|
|
9
|
|
|
|
|
|
|
extends 'HTML::FormFu::Deflator'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has relative => ( is => 'rw', traits => ['Chained'] ); |
12
|
|
|
|
|
|
|
has absolute => ( is => 'rw', traits => ['Chained'] ); |
13
|
|
|
|
|
|
|
has basename => ( is => 'rw', traits => ['Chained'] ); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub deflator { |
16
|
4
|
|
|
4
|
0
|
6
|
my ( $self, $value ) = @_; |
17
|
4
|
50
|
|
|
|
10
|
return $value unless ( ref $value ); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# we default to relative(1) |
20
|
4
|
100
|
100
|
|
|
102
|
$self->relative(1) |
|
|
|
100
|
|
|
|
|
21
|
|
|
|
|
|
|
unless ( $self->absolute || $self->basename || $self->relative ); |
22
|
|
|
|
|
|
|
|
23
|
4
|
100
|
|
|
|
95
|
if ( $self->relative ) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
24
|
2
|
100
|
|
|
|
49
|
return $value->relative( |
25
|
|
|
|
|
|
|
$self->relative eq "1" ? undef : $self->relative )->stringify; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
elsif ( $self->absolute ) { |
28
|
1
|
50
|
|
|
|
24
|
return $value->absolute( |
29
|
|
|
|
|
|
|
$self->absolute eq "1" ? undef : $self->absolute )->stringify; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
elsif ( $self->basename ) { |
32
|
1
|
|
|
|
|
4
|
return $value->basename; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# fallback, should never happen |
36
|
0
|
|
|
|
|
|
return $value->stringify; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=pod |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=encoding UTF-8 |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 NAME |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
HTML::FormFu::Deflator::PathClassFile - Deflator for Path::Class::File objects |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 VERSION |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
version 2.07 |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 SYNOPSIS |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
$form->deflator( PathClassFile => 'file' ) |
60
|
|
|
|
|
|
|
->relative( 'root' ); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
--- |
63
|
|
|
|
|
|
|
elements: |
64
|
|
|
|
|
|
|
- type: Text |
65
|
|
|
|
|
|
|
deflator: |
66
|
|
|
|
|
|
|
- type: PathClassFile |
67
|
|
|
|
|
|
|
relative: root |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 DESCRIPTION |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Deflator for Path::Class::File objects. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
There are three types of deflation: |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=over |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item relative |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Set this to 1 to deflate to a relative path. Anything else than 1 specifies the |
80
|
|
|
|
|
|
|
directory to use as the base of relativity - otherwise the current working |
81
|
|
|
|
|
|
|
directory will be used. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item absolute |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Set this to 1 to deflate to an absolute path. Anything else than 1 specifies the |
86
|
|
|
|
|
|
|
directory to use as the base of relativity - otherwise the current working |
87
|
|
|
|
|
|
|
directory will be used. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item basename |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Set this to 1 to get the name of the file without the directory portion. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=back |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
As you cannot set values for a File element, this deflator will only work |
96
|
|
|
|
|
|
|
on regular form elements. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 AUTHOR |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Moritz Onken, C<onken@houseofdesign.de> |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 LICENSE |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
105
|
|
|
|
|
|
|
the same terms as Perl itself. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 AUTHOR |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Carl Franks <cpan@fireartist.com> |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
This software is copyright (c) 2018 by Carl Franks. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
116
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |