| 1 | package Apache::Application::Plus ; | ||
| 2 | $VERSION = 1.21 ; | ||
| 3 | 1 | ▶ | use strict ; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | # This file uses the "Perlish" coding style | ||
| 6 | # please read http://perl.4pro.net/perlish_coding_style.html | ||
| 7 | |||
| 8 | 1 | ▶ | ; use base 'CGI::Application::Plus' |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 1 | ; use mod_perl | |
| 10 | ; use constant MP2 => $mod_perl::VERSION >= 1.99 | ||
| 11 | |||
| 12 | ; BEGIN | ||
| 13 | { require File::Basename | ||
| 14 | ; if ( MP2 ) | ||
| 15 | { require Apache::RequestRec | ||
| 16 | ; require Apache::Response | ||
| 17 | ; require Apache::Const | ||
| 18 | ; Apache::Const->import( -compile => 'OK' ) | ||
| 19 | ; *handler = sub : method { shift()->_mp_run(@_) } | ||
| 20 | } | ||
| 21 | else | ||
| 22 | { require Apache::Constants | ||
| 23 | ; Apache::Constants->import( 'OK' ) | ||
| 24 | ; *handler = sub ($$) { shift()->_mp_run(@_) } | ||
| 25 | } | ||
| 26 | } | ||
| 27 | |||
| 28 | ; use Object::props | ||
| 29 | ( { name => 'request' | ||
| 30 | , allowed => qr/::new_object$/ | ||
| 31 | } | ||
| 32 | ) | ||
| 33 | |||
| 34 | ; sub _mp_run | ||
| 35 | { my ($s, $r) = @_ | ||
| 36 | ; $s = $s->new_object($r) unless ref $s | ||
| 37 | ; $s->run() | ||
| 38 | ; MP2 ? Apache::OK : Apache::Constants::OK | ||
| 39 | } | ||
| 40 | |||
| 41 | ; sub _split_filename | ||
| 42 | { File::Basename::fileparse( $_[1]->filename | ||
| 43 | , qr/\.[^.]+$/ | ||
| 44 | ) | ||
| 45 | } | ||
| 46 | |||
| 47 | ; sub new_object | ||
| 48 | { my ($c, $r) = @_ | ||
| 49 | ; my $RM = $c->_split_filename($r) | ||
| 50 | ; $c->new( runmode => $RM | ||
| 51 | , request => $r | ||
| 52 | ) | ||
| 53 | } | ||
| 54 | |||
| 55 | ; 1 | ||
| 56 | |||
| 57 | |||
| 58 | __END__ | ||