bin/info.pl

filter: Statementstmt 76.9% 30 / 39 Branchbran 25.0% 2 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 70.5% 36 / 51 CC 1 SCAR 0.0
CC
1
Cov
68%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/CGI/Info.pm ↑ Summary
1 #!/usr/bin/env perl
2  
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use autodie qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use CGI::Info;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 my $info = CGI::Info->new();
10  
11 1 my $tmpdir = $info->tmpdir();
12 1 my $script_name = $info->script_name();
13  
14 1 my $domain = $info->domain_name();
15 1 my $host = $info->host_name();
16 1 my $is_mobile = $info->is_mobile();
17 1 my $is_robot = $info->is_robot();
18 1 my $script_dir = $info->script_dir();
19 1 my $rootdir = $info->rootdir();
20 1 my $is_search_engine = $info->is_search_engine();
21  
22 1 print 'Status: ', $info->status(), "\n",
23 "Content-type: text/plain\n\n";
24  
25 1 print "Domain_name: $domain\n",
26 "Host_name: $host\n",
27 "Tmpdir: $tmpdir\n",
28 "Is_mobile: $is_mobile\n",
29 "Is_robot: $is_robot\n",
30 "Is_search_engine: $is_search_engine\n",
31 "Script_dir: $script_dir\n",
32 "Rootdir: $rootdir\n",
33 "Script_name: $script_name\n-----\n";
34  
35 1 ▶if($info->params()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($info->params) 1 0 1
36 1 my %FORM = %{$info->params()};
37 1 for my $key (sort keys %FORM) {
38 1 print "$key => $FORM{$key}\n";
39 }
40 }
41  
42 1 ▶if($ENV{'HTTP_COOKIE'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"HTTP_COOKIE"}) 0 1 1
43 0 print 'HTTP_COOKIE: ', $ENV{'HTTP_COOKIE'}, "\n",
44 "Cookies:\n";
45  
46 0 foreach my $cookie(split (/\s*;\s*/, $ENV{'HTTP_COOKIE'})) {
47 0 my ($key, $value) = split(/=/, $cookie);
48  
49 0 print "Cookie $key:\n";
50 0 my $c = $info->cookie(cookie_name => $key);
51 0 ▶ if(!defined($c)) {
Branch: 2 branches
BranchTrueFalseTotal
if (not defined $c) { } 0 0 0
elsif ($c eq $value) { } 0 0 0
52 0 print "ERROR: Expected $value, got undef\n";
53 } elsif($c eq $value) {
54 0 print "$c\n";
55 } else {
56 0 print "ERROR: Expected $value, got $c\n";
57 }
58 }
59 }
« blib/lib/CGI/Info.pm ↑ Summary