File Coverage

asp-perl
Criterion Covered Total %
statement 23 23 100.0
branch n/a
condition 1 3 33.3
subroutine 8 8 100.0
pod n/a
total 32 34 94.1


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2              
3             # for more accurate per request time accounting
4             BEGIN {
5 1     1   638 eval "use Time::HiRes";
  1     1   982  
  1         2213  
  1         5  
6 1   33     115 $Apache::ASP::QuickStartTime = eval { &Time::HiRes::time(); } || time();
7             }
8              
9             # help section
10 1     1   7 use File::Basename;
  1         1  
  1         87  
11 1     1   3010 use Getopt::Std;
  1         60  
  1         80  
12 1     1   7 use Cwd;
  1         2  
  1         70  
13 1     1   7 use Carp qw(confess);
  1         3  
  1         54  
14 1     1   461 use Apache::ASP::CGI;
  1         9  
  1         1632  
15              
16             =pod
17              
18             =head1 NAME
19              
20             asp-perl - Apache::ASP CGI and command line script processor
21              
22             =head1 SYNOPSIS
23              
24             asp-perl [-hsdb] [-f asp.conf] [-o directory] file1 @arguments file2 @arguments ...
25              
26             -h Help you are getting now!
27             -f Specify an alternate configuration file other than ./asp.conf
28             -s Setup $Session and $Application state for script.
29             -d Set to debug code upon errors.
30             -b Only return body of document, no headers.
31             -o Output directory, writes to files there instead of STDOUT
32             -p GlobalPackage config, what perl package are the scripts compiled in.
33              
34             =head1 DESCRIPTION
35              
36             This program will run Apache::ASP scripts from the command line.
37             Each file that is specified will be run, and the
38             $Request->QueryString() and $Request->Form() data will be
39             initialized by the @arguments following the script file name.
40              
41             The @arguments will be written as space separated
42             words, and will be initialized as an associate array where
43             %arguments = @arguments. As an example:
44              
45             asp-perl file.asp key1 value1 key2 value2
46              
47             would be similar to calling the file.asp in a web environment like
48              
49             /file.asp?key1=value1&key2=value2
50              
51             The asp.conf script will be read from the current directory
52             for parameters that would be set with PerlSetVar normally under
53             mod_perl. For more information on how to configure the asp.conf
54             file, please see < http://www.apache-asp.org/cgi.html >
55              
56             =head1 SEE ALSO
57              
58             perldoc Apache::ASP, and also http://www.apache-asp.org
59              
60             =head1 COPYRIGHT
61              
62             Copyright 1998-2004 Joshua Chamas, Chamas Enterprises Inc.
63              
64             This program is distributed under the GPL. Please see the LICENSE
65             file in the Apache::ASP distribution for more information.
66              
67             =cut
68              
69             $SIG{__DIE__} = \&confess;
70             getopts('hsdbo:p:f:');
71              
72             if($opt_h || ! @ARGV) {
73             open(SCRIPT, $0) || die("can't open $0 for reading: $!");
74             my $script = join('',