Apache2-ASP

 view release on metacpan or  search on metacpan

lib/Apache2/ASP/ModPerl2CGI.pm  view on Meta::CPAN


package Apache2::ASP::ModPerl2CGI;

use strict;
use warnings;
use base 'CGI::Apache2::Wrapper';
use Apache2::ASP::SimpleCGI;
use Carp 'confess';


#==============================================================================
sub new
{
  my ($class, $r, $upload_hook) = @_;

  my $s = $class->SUPER::new( $r );
  $s->{r} = $r;
  if( ref($upload_hook) eq 'CODE' )
  {
    my $req = Apache2::Request->new(
      $r,
      UPLOAD_HOOK => $upload_hook,
    );
    $s->req(
      $req
    );
  }
  else
  {
    $s->req( Apache2::Request->new( $r ) );
  }# end if()
  
  return $s;
}# end new()


#==============================================================================
sub escape
{
  my ($s, $str) = @_;
  
  return Apache2::ASP::SimpleCGI->escape( $str );
}# end escape()


#==============================================================================
sub unescape
{
  my ($s, $str) = @_;
  
  return Apache2::ASP::SimpleCGI->unescape( $str );
}# end unescape()


#==============================================================================
sub AUTOLOAD
{
  my $s = shift;
  our $AUTOLOAD;
  my ($name) = $AUTOLOAD =~ m/([^:]+)$/;
  eval { return $s->{r}->$name( @_ ) };
  confess $@ if $@;
}# end AUTOLOAD()


#==============================================================================
sub DESTROY
{
  my $s = shift;
  delete($s->{$_}) foreach keys(%$s);
}# end DESTROY()


1;# return true:

__END__



( run in 0.907 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )