| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Egg::Plugin::Request::Upload; | 
| 2 |  |  |  |  |  |  | # | 
| 3 |  |  |  |  |  |  | # Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt> | 
| 4 |  |  |  |  |  |  | # | 
| 5 |  |  |  |  |  |  | # $Id: Upload.pm 337 2008-05-14 12:30:09Z lushe $ | 
| 6 |  |  |  |  |  |  | # | 
| 7 | 1 |  |  | 1 |  | 443 | use strict; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 37 |  | 
| 8 | 1 |  |  | 1 |  | 6 | use warnings; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 31 |  | 
| 9 | 1 |  |  | 1 |  | 7 | use UNIVERSAL::require; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 11 |  | 
| 10 | 1 |  |  | 1 |  | 26 | use Egg::View::Template::GlobalParam; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 15 |  | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | our $VERSION= '3.00'; | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | sub _setup { | 
| 15 | 0 |  |  | 0 |  |  | my($e)= @_; | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 0 | 0 |  |  |  |  | my $pkg= 'Egg::Request::Upload::'. ($e->mp_version ? 'ModPerl': 'CGI'); | 
| 18 | 0 | 0 |  |  |  |  | $pkg->require or die $@; | 
| 19 |  |  |  |  |  |  |  | 
| 20 | 0 |  |  |  |  |  | $Egg::View::Template::GlobalParam::param{upload_enctype}= 'multipart/form-data'; | 
| 21 |  |  |  |  |  |  |  | 
| 22 | 1 |  |  | 1 |  | 84 | no strict 'refs';  ## no critic. | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 74 |  | 
| 23 | 0 |  |  |  |  |  | push @{'Egg::Request::handler::ISA'}, $pkg; | 
|  | 0 |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  |  | 
| 25 | 0 |  |  |  |  |  | "${pkg}::handler"->_setup($e); | 
| 26 | 0 |  |  |  |  |  | $e->next::method; | 
| 27 |  |  |  |  |  |  | } | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | 1; | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | __END__ | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | =head1 NAME | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | Egg::Plugin::Upload - File upload function. | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | use Egg qw/ Request::Upload /; | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | # Acquisition of up-loading object. | 
| 42 |  |  |  |  |  |  | my $upload= $e->request->upload('upload_param_name'); | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | File upload function availably setup L<Egg::Request::Upload> to this module. | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | The 'upload' method is added to $e-E<gt>request by this setup. | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | This plugin doesn't have the method that can be used. | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | see L<Egg::Request::Upload>. | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | L<Egg::Release>, | 
| 57 |  |  |  |  |  |  | L<Egg::Request>, | 
| 58 |  |  |  |  |  |  | L<Egg::Request::Upload>, | 
| 59 |  |  |  |  |  |  | L<Egg::Request::Upload::CGI>, | 
| 60 |  |  |  |  |  |  | L<Egg::Request::Upload::ModPerl>, | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | =head1 AUTHOR | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt> | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | Copyright (C) 2008 Bee Flag, Corp. E<lt>L<http://egg.bomcity.com/>E<gt>. | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | This library is free software; you can redistribute it and/or modify | 
| 71 |  |  |  |  |  |  | it under the same terms as Perl itself, either Perl version 5.8.6 or, | 
| 72 |  |  |  |  |  |  | at your option, any later version of Perl 5 you may have available. | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  | =cut | 
| 75 |  |  |  |  |  |  |  |