DevPopup/Log.pm

filter: Statementstmt 42.1% 16 / 38 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 4 / 8 Podpod 100% 1 / 1 totaltotal 39.6% 21 / 53 CC 4 SCAR 16.3
CC
4
Cov
36%
_log_report
12.0
devpopup_log_handle
6.0
import
2.0
CRAP 5.1
↑ Summary DevPopup/Timing.pm »
1 package CGI::Application::Plugin::DevPopup::Log;
2 {
3 1 $CGI::Application::Plugin::DevPopup::Log::VERSION = '1.08';
4 }
5  
6 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use IO::Scalar;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use base qw/Exporter/;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use vars qw($VERSION @EXPORT);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 @EXPORT = qw(devpopup_log_handle);
12  
13 sub import
14 0 ▶{
Subroutine import: not called CC=1 SCAR=6.9
15 0 my $c = scalar caller;
16 0 $c->add_callback( 'devpopup_report', \&_header_report );
17 0 goto &Exporter::import;
18 }
19  
20 sub _header_report
21 0 ▶{
Subroutine _header_report: not called CC=1 SCAR=6.9
22 0 my $self = shift;
23  
24 0 my $log = _log_report($self);
25  
26 0 $self->devpopup->add_report(
27 title => 'Logs',
28 summary => '',
29 report => qq(
30 <style type="text/css">
31 tr.even{background-color:#eee}
32 </style>
33 <table><thead><th colspan="1">Logs</th></thead><tbody> $log </tbody></table>
34 )
35 );
36 }
37  
38 sub _log_report
39 0 ▶{
Subroutine _log_report: not called CC=3 SCAR=24.8
40 0 my $self = shift;
41 0 my $data = $self->{__DEVPOPUP_LOGDATA};
42 0 ▶ return '' unless (ref $data eq 'SCALAR');
Branch: 1 branch
BranchTrueFalseTotal
unless ref $data eq "SCALAR" 0 0 0
43 0 my $r=0;
44 my $report = join $/, map {
45 0 $r=1-$r;
46 0 ▶ qq{<tr class="@{[$r?'odd':'even']}"><td style="white-space: pre;"> $_ </td></tr>}
Branch: 1 branch
BranchTrueFalseTotal
$r ? : 0 0 0
47 }
48 split /\n/, $$data;
49  
50 0 return $report;
51 }
52  
53 sub devpopup_log_handle
54 0 ▶{
Subroutine devpopup_log_handle: not called CC=2 SCAR=17.9
Pod documented
55 0 my $this = shift;
56  
57 0 ▶ unless (ref $this->{__DEVPOPUP_LOGFH})
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $this->{"__DEVPOPUP_LOGFH"}) 0 0 0
58 {
59 0 my $data = '';
60 0 $this->{__DEVPOPUP_LOGDATA} = \$data;
61 0 my $fh = new IO::Scalar \$data;
62 0 $this->{__DEVPOPUP_LOGFH} = $fh;
63 }
64  
65 0 return $this->{__DEVPOPUP_LOGFH};
66 }
67  
68 1 1; # End of CGI::Application::Plugin::DevPopup::Log
69  
70 __END__
↑ Summary DevPopup/Timing.pm »