blib/lib/WebDyne/CGI.pm untested

filter: Statementstmt 0.0% 0 / 41 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 18 MC/DCmcdc 0.0% 0 / 12 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 84 CC 3 SCAR 16.1
CC
3
Cov
0%
new
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 5.0
1 #
2 # This file is part of WebDyne.
3 #
4 # This software is copyright (c) 2026 by Andrew Speer <andrew.speer@isolutions.com.au>.
5 #
6 # This is free software; you can redistribute it and/or modify it under
7 # the same terms as the Perl 5 programming language system itself.
8 #
9 # Full license text is available at:
10 #
11 # <http://dev.perl.org/licenses/>
12 #
13 package WebDyne::CGI;
14  
15  
16 # Pragma
17 #
18 use strict qw(vars);
19 use vars qw($VERSION $AUTOLOAD);
20 use warnings;
21 no warnings qw(uninitialized redefine);
22  
23  
24 # WebDyne Modules
25 #
26 use WebDyne::Util;
27 use WebDyne::CGI::Simple;
28  
29  
30 # External modules
31 #
32 use Data::Dumper;
33  
34  
35 # Version information
36 #
37 $VERSION='3.029';
38  
39  
40 # Debug load
41 #
42 0 && debug("Loading %s version $VERSION", __PACKAGE__);
43  
44  
45 #==============================================================================
46  
47 sub new {
48  
49
50 # Setup universal CGI object for return
51 #
52 my ($class, $r, %param)=@_;
53 0 && debug("class: $class, r:$r, caller: %s", Dumper([caller(0)]));
54  
55  
56 # Only generate if not already done
57 #
58 my $cgi_or=($r->{'_CGI'} ||= do {
59
60 # Take forms and STDIN content into account
61 #
62 if (($r->headers_in('content-type') eq 'application/x-www-form-urlencoded') && $r->content_length()) {
63 my $body=$r->body();
64 WebDyne::CGI::Simple->new($r, $r->args, $body);
65 }
66 elsif ($r->content_length()) {
67 my $cgi_or=WebDyne::CGI::Simple->new($r, $r->args);
68 local $ENV{'CONTENT_LENGTH'} ||= $r->content_length();
69 local $ENV{'CONTENT_TYPE'} ||= $r->headers_in('Content-Type');
70 local *STDIN=$r->input();
71 $cgi_or->_parse_multipart($r->input());
72 $cgi_or;
73 }
74 else {
75 WebDyne::CGI::Simple->new($r, $r->args);
76 }
77 });
78 return $cgi_or;
79  
80 }
81  
82 1;
83 __END__