| 1 | |||
| 2 | package Apache2::ASP::ModPerl2CGI; | ||
| 3 | |||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | use base 'CGI::Apache2::Wrapper'; | ||
| 7 | use Apache2::ASP::SimpleCGI; | ||
| 8 | use Carp 'confess'; | ||
| 9 | |||
| 10 | |||
| 11 | #============================================================================== | ||
| 12 | sub new | ||
| 13 | { | ||
| 14 | my ($class, $r, $upload_hook) = @_; | ||
| 15 | |||
| 16 | my $s = $class->SUPER::new( $r ); | ||
| 17 | $s->{r} = $r; | ||
| 18 | if( ref($upload_hook) eq 'CODE' ) | ||
| 19 | { | ||
| 20 | my $req = Apache2::Request->new( | ||
| 21 | $r, | ||
| 22 | UPLOAD_HOOK => $upload_hook, | ||
| 23 | ); | ||
| 24 | $s->req( | ||
| 25 | $req | ||
| 26 | ); | ||
| 27 | } | ||
| 28 | else | ||
| 29 | { | ||
| 30 | $s->req( Apache2::Request->new( $r ) ); | ||
| 31 | }# end if() | ||
| 32 | |||
| 33 | return $s; | ||
| 34 | }# end new() | ||
| 35 | |||
| 36 | |||
| 37 | #============================================================================== | ||
| 38 | sub escape | ||
| 39 | { | ||
| 40 | my ($s, $str) = @_; | ||
| 41 | |||
| 42 | return Apache2::ASP::SimpleCGI->escape( $str ); | ||
| 43 | }# end escape() | ||
| 44 | |||
| 45 | |||
| 46 | #============================================================================== | ||
| 47 | sub unescape | ||
| 48 | { | ||
| 49 | my ($s, $str) = @_; | ||
| 50 | |||
| 51 | return Apache2::ASP::SimpleCGI->unescape( $str ); | ||
| 52 | }# end unescape() | ||
| 53 | |||
| 54 | |||
| 55 | #============================================================================== | ||
| 56 | sub AUTOLOAD | ||
| 57 | { | ||
| 58 | my $s = shift; | ||
| 59 | our $AUTOLOAD; | ||
| 60 | my ($name) = $AUTOLOAD =~ m/([^:]+)$/; | ||
| 61 | eval { return $s->{r}->$name( @_ ) }; | ||
| 62 | confess $@ if $@; | ||
| 63 | }# end AUTOLOAD() | ||
| 64 | |||
| 65 | |||
| 66 | #============================================================================== | ||
| 67 | sub DESTROY | ||
| 68 | { | ||
| 69 | my $s = shift; | ||
| 70 | delete($s->{$_}) foreach keys(%$s); | ||
| 71 | }# end DESTROY() | ||
| 72 | |||
| 73 | |||
| 74 | 1;# return true: | ||
| 75 | |||
| 76 | __END__ |