File Coverage

blib/lib/Embperl/Run.pm
Criterion Covered Total %
statement 29 29 100.0
branch 6 12 50.0
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 40 47 85.1


line stmt bran cond sub pod time code
1              
2             ###################################################################################
3             #
4             # Embperl - Copyright (c) 1997-2008 Gerald Richter / ecos gmbh www.ecos.de
5             # Embperl - Copyright (c) 2008-2014 Gerald Richter
6             #
7             # You may distribute under the terms of either the GNU General Public
8             # License or the Artistic License, as specified in the Perl README file.
9             #
10             # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
11             # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
12             # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13             #
14             # $Id: Run.pm 1578075 2014-03-16 14:01:14Z richter $
15             #
16             ###################################################################################
17              
18              
19             package Embperl::Run ;
20              
21 1     1   1455 use Embperl ;
  1         2  
  1         48  
22 1     1   7 use Embperl::Constant ;
  1         2  
  1         21  
23 1     1   6 use Embperl::Log ;
  1         3  
  1         28  
24              
25 1     1   6 use Getopt::Long ;
  1         2  
  1         10  
26              
27              
28              
29             sub run (;\@$)
30            
31             {
32 58 50   58 0 482344 @ARGV = @{$_[0]} if (ref $_[0] eq 'ARRAY') ;
  58         280  
33              
34 58         146 eval { Getopt::Long::Configure ('bundling') } ;
  58         376  
35 58         2519 $@ = "" ;
36 58         117 my %param ;
37 58         332 my $ret = GetOptions (\%param,
38             "outputfile|o=s", "inputfile|i=s",
39             "log|l=s", "debug|d=i", "options|t=i",
40             "param|p=s@", "syntax|s=s", "fdat|f=s%") ;
41            
42 58 50       58550 return undef if (!$ret) ;
43              
44 58 50       220 if (@ARGV)
45             {
46 58         441 $ENV{PATH_TRANSLATED} = $param{'inputfile'} = shift @ARGV ;
47             }
48              
49 58 50       204 if (@ARGV)
50             {
51 58         232 $ENV{QUERY_STRING} = shift @ARGV ;
52 58 50       218 undef $ENV{CONTENT_LENGTH} if (defined ($ENV{CONTENT_LENGTH})) ;
53             }
54            
55            
56 58 50       252 $param{'param'} = $_[1] if (defined ($_[1])) ;
57 58         142 $param{'use_env'} = 1 ;
58              
59 58         303 $rc = Embperl::Execute (\%param) ;
60              
61 58         418 return $rc ;
62             }
63              
64             1 ;
65