line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::Test::Input::Custom; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
20588
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
6
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
7
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
100
|
|
8
|
1
|
|
|
1
|
|
933
|
use Encode qw(encode); |
|
1
|
|
|
|
|
11436
|
|
|
1
|
|
|
|
|
103
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
9
|
use base 'CGI::Test::Input'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
918
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub _firstdef { |
13
|
0
|
|
0
|
0
|
|
|
defined && return $_ for @_; |
14
|
0
|
|
|
|
|
|
undef; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub new { |
18
|
0
|
|
|
0
|
1
|
|
my ($class, %args) = @_; |
19
|
0
|
|
|
|
|
|
my $this = bless {}, $class; |
20
|
0
|
|
|
|
|
|
$this->_init; |
21
|
0
|
|
|
|
|
|
$this->{_ctic_mime_type} = _firstdef(delete $args{-mime_type}, 'application/octet-stream'); |
22
|
0
|
|
|
|
|
|
$this->{_data_decoded} = _firstdef(delete $args{-content}, ''); |
23
|
0
|
|
|
|
|
|
$this->{_encoding} = _firstdef(delete $args{-encoding}, 'utf8'); |
24
|
0
|
0
|
|
|
|
|
%args and croak "unsupported constructor argument(s) ".join(', ', keys %args); |
25
|
0
|
|
|
|
|
|
$this->{stale} = 1; |
26
|
0
|
|
|
|
|
|
$this; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
*make = \&new; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
for (qw(widget field file file_now)) { |
32
|
|
|
|
|
|
|
my $m = "add_$_"; |
33
|
1
|
|
|
1
|
|
1228
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
249
|
|
34
|
0
|
|
|
0
|
|
|
*$m = sub { croak "method '$m' is not supported by ".__PACKAGE__." objects" }; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub set_mime_type { |
38
|
0
|
|
|
0
|
1
|
|
my ($this, $type) = @_; |
39
|
0
|
|
|
|
|
|
$this->{_ctic_mime_type} = $type; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
0
|
1
|
|
sub mime_type { shift->{_ctic_mime_type} } |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub _build_data { |
45
|
0
|
|
|
0
|
|
|
my $this = shift; |
46
|
0
|
|
|
|
|
|
encode($this->{_encoding}, $this->{_data_decoded}) |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub add_content { |
50
|
0
|
|
|
0
|
1
|
|
my $this = shift; |
51
|
0
|
|
|
|
|
|
$this->{_data_decoded} .= join('', @_); |
52
|
0
|
|
|
|
|
|
$this->{stale} = 1; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
__END__ |