Lazy/CSS.pm

filter: Statementstmt 34.4% 10 / 29 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 42.8% 3 / 7 Podpod 100% 5 / 5 totaltotal 40.0% 18 / 45 CC 3 SCAR 16.1
CC
3
Cov
30%
load
12.0
dir
2.0
file
2.0
CRAP 5.0
« Lazy.pm ↑ Summary Lazy/ErrorHandler.pm »
1 package CGI::Lazy::CSS;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use CGI::Lazy::Globals;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 #-------------------------------------------------------------------------------------------------
8 0 ▶sub dir {
Subroutine dir: not called CC=1 SCAR=6.9
Pod documented
9 0 my $self = shift;
10  
11 0 return $self->{_dir};
12 }
13  
14 #----------------------------------------------------------------------------------------
15 0 ▶sub file {
Subroutine file: not called CC=1 SCAR=6.9
Pod documented
16 0 my $self = shift;
17 0 my $file = shift;
18  
19 0 my $dir = $self->dir;
20  
21 0 return "$dir/$file";
22 }
23  
24 #----------------------------------------------------------------------------------------
25 0 ▶sub load {
Subroutine load: not called CC=3 SCAR=24.8
Pod documented
26 0 my $self = shift;
27 0 my $file = shift;
28
29 0 my $dir = $self->dir;
30 0 $dir =~ s/^\///; #strip a leading slash so we don't double it
31 0 my $docroot = $ENV{DOCUMENT_ROOT};
32 0 $docroot =~ s/\/$//; #strip the trailing slash so we don't double it
33  
34 0 ▶ open IF, "< $docroot/$dir/$file" or $self->q->errorHandler->couldntOpenCssFile($docroot, $dir, $file, $!);
Branch: 1 branch
BranchTrueFalseTotal
open IF, "< $docroot/$dir/$file" or $self->q->errorHandler->couldntOpenCssFile($docroot, $dir, $file, $!) 0 0 0
35  
36 0 my $script;
37  
38 0 ▶ $script .= $_ while <IF>;
Branch: 1 branch
BranchTrueFalseTotal
defined($_ = readline IF) and do { $script .= $_ } 0 0 0
39  
40 0 close IF;
41  
42 0 return $self->q->csswrap($script);
43  
44 }
45  
46 #-------------------------------------------------------------------------------------------------
47 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
48 1 my $class = shift;
49 1 my $q = shift;
50  
51 1 return bless {
52 _q => $q,
53 _dir => $q->config->cssDir,
54
55 }, $class;
56 }
57  
58 #-------------------------------------------------------------------------------------------------
59 0 ▶sub q {
Subroutine q: not called CC=1 SCAR=6.9
Pod documented
60 0 my $self = shift;
61  
62 0 return $self->{_q};
63 }
64  
65 1 1
66  
67 __END__
« Lazy.pm ↑ Summary Lazy/ErrorHandler.pm »