3 use HTML::Mason::CGIHandler;
7 my $script_filename = $ENV{'SCRIPT_FILENAME'};
8 my $basis = shift @ARGV;
9 sub absify ($) { $_[0] =~ m#^/# ? $_[0] : "$basis/$_[0]"; }
10 my $perllib = absify shift @ARGV;
11 my $comp_root = absify shift @ARGV;
13 unshift @INC, $perllib;
15 my $pathsofar = $comp_root;
16 die "$pathsofar $!" unless stat $pathsofar;
18 my $path_info = $ENV{'PATH_INFO'};
19 $path_info='' if !defined $path_info;
21 foreach my $pathcomp (split m#/#, $path_info) {
22 next if $pathcomp eq '';
23 $pathcomp =~ m/^[,_0-9A-Za-z]/ or path_fail('bad initial character');
24 $pathcomp =~ m/[-+:.,_0-9A-Za-z]$/ or path_fail('bad final character');
25 $pathcomp ne 'autohandler' or path_fail('refers to autohandler');
26 $pathcomp ne 'dhandler' or path_fail('refers to dhandler');
27 $pathsofar .= "/$pathcomp";
28 next if access($pathsofar, X_OK);
29 die "$pathsofar $!" unless $!==&ENOENT or $!==&ENOTDIR;
34 $h or $h = HTML::Mason::CGIHandler->new(comp_root => $comp_root);