line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OpenFrame::Argument::Blob; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1057
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings::register; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
176
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
1402
|
use IO::Null; |
|
1
|
|
|
|
|
17830
|
|
|
1
|
|
|
|
|
63
|
|
7
|
1
|
|
|
1
|
|
1014
|
use OpenFrame::Object; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use base qw ( OpenFrame::Object ); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION=3.05; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub init { |
13
|
|
|
|
|
|
|
my $self = shift; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
$self->name( '' ); ## initialize the argument name |
16
|
|
|
|
|
|
|
$self->filename( '' ); ## initialize the filename |
17
|
|
|
|
|
|
|
$self->filehandle( IO::Null->new() ); ## initialize the filehandle |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
$self->SUPER::init(@_); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub name { |
23
|
|
|
|
|
|
|
my $self = shift; |
24
|
|
|
|
|
|
|
my $name = shift; |
25
|
|
|
|
|
|
|
if (defined($name)) { |
26
|
|
|
|
|
|
|
$self->{name} = $name; |
27
|
|
|
|
|
|
|
return $self; |
28
|
|
|
|
|
|
|
} else { |
29
|
|
|
|
|
|
|
return $self->{name}; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub filename { |
34
|
|
|
|
|
|
|
my $self = shift; |
35
|
|
|
|
|
|
|
my $file = shift; |
36
|
|
|
|
|
|
|
if (defined($file)) { |
37
|
|
|
|
|
|
|
$self->{filename} = $file; |
38
|
|
|
|
|
|
|
return $self; |
39
|
|
|
|
|
|
|
} else { |
40
|
|
|
|
|
|
|
return $self->{filename}; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub filehandle { |
45
|
|
|
|
|
|
|
my $self = shift; |
46
|
|
|
|
|
|
|
my $fh = shift; |
47
|
|
|
|
|
|
|
if (defined($fh)) { |
48
|
|
|
|
|
|
|
$self->{filehandle} = $fh; |
49
|
|
|
|
|
|
|
return $self; |
50
|
|
|
|
|
|
|
} else { |
51
|
|
|
|
|
|
|
return $self->{filehandle}; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub STORABLE_freeze { |
56
|
|
|
|
|
|
|
my $self = shift; |
57
|
|
|
|
|
|
|
$self->filehandle(''); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub STORABLE_thaw { |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 NAME |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
OpenFrame::Argument::Blob - handling for filehandle-style data in network requests |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 SYNOPSIS |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
use OpenFrame::Argument::Blob; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
my $blob = OpenFrame::Argument::Blob->new(); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
$blob->filename( 'somefilename.dat' ); |
77
|
|
|
|
|
|
|
$blob->filehandle( $fh ); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
my $filename = $blob->filename; |
80
|
|
|
|
|
|
|
my $filehandle = $blob->filehandle; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 DESCRIPTION |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
C is a class to support things such as browser-based uploads. It provides |
85
|
|
|
|
|
|
|
a mechanisms to get the filehandle and filename of the uploaded element. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 METHODS |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=over 4 |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item filename( [ SCALAR ] ) |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
The C method gets/sets the value of the filename attribute of the class. This should return |
94
|
|
|
|
|
|
|
the filename of the uploaded data. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item filehandle( [ IO::Handle ] ) |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
The C method gets/sets the value of the filehandle that points to the uploaded data. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=back |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 INHERITANCE |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
C inherits from the C class and provides all methods that |
105
|
|
|
|
|
|
|
its super class does. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 AUTHOR |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
James A. Duncan |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 COPYRIGHT |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Copyright 2002 Fotango Ltd. All Rights Reserved. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This code is released under the GNU GPL and Artistic licenses. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|