File Coverage

lib/Egg/Request/Upload/ModPerl.pm
Criterion Covered Total %
statement 12 20 60.0
branch 0 4 0.0
condition n/a
subroutine 4 11 36.3
pod 1 1 100.0
total 17 36 47.2


line stmt bran cond sub pod time code
1             package Egg::Request::Upload::ModPerl;
2             #
3             # Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
4             #
5             # $Id: ModPerl.pm 337 2008-05-14 12:30:09Z lushe $
6             #
7 1     1   499 use strict;
  1         2  
  1         34  
8 1     1   4 use warnings;
  1         3  
  1         88  
9              
10             our $VERSION = '3.00';
11              
12             sub upload {
13 0 0   0 1   Egg::Request::Upload::ModPerl::handler->new(@_) || (undef);
14             }
15              
16             package Egg::Request::Upload::ModPerl::handler;
17 1     1   6 use strict;
  1         1  
  1         30  
18 1     1   5 use base qw/ Egg::Request::Upload /;
  1         2  
  1         299  
19              
20             sub _setup {
21 0     0     my($class)= @_;
22 0 0         Egg::Request->mp_version >= 1.99922
23             ? require Apache2::Upload : require Apache::Upload ;
24             }
25 0     0     sub filename { $_[0]->handle->filename }
26 0     0     sub tempname { $_[0]->handle->tempname }
27 0     0     sub size { $_[0]->handle->size }
28 0     0     sub type { $_[0]->handle->type }
29 0     0     sub info { $_[0]->handle->info }
30              
31             1;
32              
33             __END__
34              
35             =head1 NAME
36              
37             Egg::Request::Upload::ModPerl - File upload by Apache::Upload.
38              
39             =head1 DESCRIPTION
40              
41             L<Apache::Upload> It is a module to use the file upload function.
42              
43             This module is set up by L<Egg::Plugin::Request::Upload>.
44              
45             In addition, mp_version is examined and either of L<Apache::Upload> or
46             L<Apache::Upload2> is read.
47              
48             =head1 METHODS
49              
50             =head2 upload ([PARAM_NAME])
51              
52             The Egg::Request::Upload::ModPerl::handler object is returned.
53              
54             Undefined returns when the 'upload' object cannot be acquired in PARAM_NAME.
55              
56             =head1 HANDLER METHODS
57              
58             This class has succeeded to L<Egg::Request::Upload>.
59              
60             =head2 filename
61              
62             The file name of the up-loading file is returned.
63              
64             There seems to be a thing that the file name including the directory of the
65             upload environment of the client is returned though it might be the one by the
66             environment.
67              
68             When only the file name is acquired, it is good to use 'catfilename' method of
69             L<Egg::Request::Upload>.
70              
71             my $filename= $upload->filename;
72              
73             =head2 tempname
74              
75             The work passing of the up-loading file is temporarily returned.
76              
77             my $tmpfile= $upload->tempname;
78              
79             =head2 size
80              
81             The size of the upload file is returned.
82              
83             =head2 type
84              
85             The contents type of the upload file is returned.
86              
87             =head2 info
88              
89             Information on the upload file is returned.
90              
91             my $type = $upload->info->{'Content-Type'};
92              
93             =head1 SEE ALSO
94              
95             L<Egg::Release>,
96             L<Egg::Request>,
97             L<Egg::Request::Upload>,
98             L<Egg::Plugin::Request::Upload>,
99             L<Apache::Upload>,
100             L<Apache::Upload2>,
101              
102             =head1 AUTHOR
103              
104             Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
105              
106             =head1 COPYRIGHT AND LICENSE
107              
108             Copyright (C) 2008 Bee Flag, Corp. E<lt>L<http://egg.bomcity.com/>E<gt>.
109              
110             This library is free software; you can redistribute it and/or modify
111             it under the same terms as Perl itself, either Perl version 5.8.6 or,
112             at your option, any later version of Perl 5 you may have available.
113              
114             =cut
115