CGI::Apache2::Wrapper::Upload - uploads via libapreq2


CGI-Apache2-Wrapper documentation Contained in the CGI-Apache2-Wrapper distribution.

Index


Code Index:

NAME

Top

CGI::Apache2::Wrapper::Upload - uploads via libapreq2

SYNOPSIS

Top

  use CGI::Apache2::Wrapper::Upload;

  my $cgi = CGI::Apache2::Wrapper->new($r);
  my $upload = $cgi->req->upload("foo");

DESCRIPTION

Top

This module is a mod_perl wrapper around the upload functionality of libapreq2, for use by CGI::Apache2::Wrapper. It is very similar to Apache2::Upload, but only provides the tempname method for accessing the contents of an uploaded file. It is not intended to be used directly; rather, the upload method of CGI::Apache2::Wrapper should be used.

SEE ALSO

Top

CGI, Apache2::Upload, and CGI::Apache2::Wrapper.

Development of this package takes place at http://cpan-search.svn.sourceforge.net/viewvc/cpan-search/CGI-Apache2-Wrapper/.

SUPPORT

Top

You can find documentation for this module with the perldoc command:

    perldoc CGI::Apache2::Wrapper::Upload

You can also look for information at:

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/CGI-Apache2-Wrapper

* CPAN::Forum: Discussion forum

http:///www.cpanforum.com/dist/CGI-Apache2-Wrapper

* CPAN Ratings

http://cpanratings.perl.org/d/CGI-Apache2-Wrapper

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=CGI-Apache2-Wrapper

* Search CPAN

http://search.cpan.org/dist/CGI-Apache2-Wrapper

http://cpan.uwinnipeg.ca/dist/CGI-Apache2-Wrapper

COPYRIGHT

Top


CGI-Apache2-Wrapper documentation Contained in the CGI-Apache2-Wrapper distribution.

package CGI::Apache2::Wrapper::Upload;
use Apache2::Request;
push our @ISA, qw/APR::Request::Param/;
our $VERSION = '0.215';
{
  no strict 'refs';
  for (qw/type size tempname filename/) {
    *{$_} = *{"APR::Request::Param::upload_$_"}{CODE};
  }
}

sub Apache2::Request::upload {
  my $req = shift;
  return unless @_;
  my $body = $req->body or return;
  $body->param_class(__PACKAGE__);
  my @uploads = grep $_->upload, $body->get(@_);
  return wantarray ? @uploads : $uploads[0];
}

*bb = *APR::Request::Param::upload;

1;

__END__