blib/lib/WebDyne/Cache.pm

filter: Statementstmt 84.8% 28 / 33 Branchbran 50.0% 1 / 2 Conditioncond 37.5% 3 / 8 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 87.5% 7 / 8 Podpod 0.0% 0 / 1 totaltotal 69.6% 39 / 56 CC 6 SCAR 12.5
CC
6
Cov
74%
handler
6.0
import
5.5
BEGIN
1.0
CRAP 3.5
« lib/WebDyne/Request/PSGI/Static.pm ↑ Summary blib/lib/WebDyne/Request/PSGI/Static.pm »
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::Cache;
14  
15  
16 # Compiler Pragma
17 #
18 2 ▶use strict qw(vars);
Subroutine BEGIN: called CC=1 SCAR=0.0
19 2 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
20 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 ▶no warnings qw(uninitialized);
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23  
24 # WebDyne Modules.
25 #
26 2 ▶use WebDyne::Constant;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 2 ▶use WebDyne::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29  
30 # Version information
31 #
32 2 $VERSION='3.029';
33  
34  
35 # Debug
36 #
37 2 0 && debug("%s loaded, version $VERSION", __PACKAGE__);
38  
39  
40 # And done
41 #
42 2 1;
43  
44 #------------------------------------------------------------------------------
45  
46  
47 7 ▶sub import {
Subroutine import: called CC=5 SCAR=17.0
48  
49  
50 # Will only work if called from within a __PERL__ block in WebDyne
51 #
52 7 my ($class, @param)=@_;
53 7 ▶ my $self_cr=UNIVERSAL::can(scalar caller, 'self') || return;
Condition50%1/2
UNIVERSAL::can(scalar caller, 'self') || (return)
l!l
70
MC/DC0%0/1
UNIVERSAL::can(scalar caller, 'self') || (return)
UNIVERSAL::can(scalar caller, 'self')
Truth table50%1/2
A
A= UNIVERSAL::can(scalar caller, 'self')
Aresult
11
00
54 7 ▶ my $self=$self_cr->() || return;
Condition50%1/2
&$self_cr() || (return)
l!l
70
MC/DC0%0/1
&$self_cr() || (return)
&$self_cr()
Truth table50%1/2
A
A= &$self_cr()
Aresult
11
00
55 7 ▶ my %param=(@param == 1) ? (cache => @param) : @param;
Branch: 1 branch
BranchTrueFalseTotal
@param == 1 ? : 7 0 7
56 7 ▶ my $meta_hr=$self->meta() || return err();
Condition50%1/2
$self->meta || (return err())
l!l
70
MC/DC0%0/1
$self->meta || (return err())
$self->meta
Truth table50%1/2
A
A= $self->meta
Aresult
11
00
57 7 $meta_hr->{'cache'}=$param{'cache'};
58 7 $meta_hr->{'static'}=1;
59  
60 }
61  
62  
63 0 ▶sub handler : method {
Subroutine handler: not called CC=2 SCAR=17.9
Pod undocumented
64  
65  
66 # Handler is a no-op, all work is done by filter code. Need a handler so
67 # module is seen by WebDyne autoload method when tracking back through
68 # chained modules
69 #
70 0 my ($self, $r)=(shift, shift);
71 0 ▶ my $cache=$r->dir_config('WebDyneCacheHandler') ||
Condition0%0/2
$r->dir_config('WebDyneCacheHandler') || (return $self->err_html('unable to get cache handler name - have you set the WebDyneCacheHandler var ?'))
l!l
00
MC/DC0%0/1
$r->dir_config('WebDyneCacheHandler') || (return $self->err_html('unable to get cache handler name - have you set the WebDyneCacheHandler var ?'))
$r->dir_config('WebDyneCacheHandler')
Truth table0%0/2
A
A= $r->dir_config('WebDyneCacheHandler')
Aresult
11
00
72 return $self->err_html(
73 'unable to get cache handler name - have you set the WebDyneCacheHandler var ?'
74 );
75 0 $self->cache($cache);
76 0 $self->static(1);
77 0 $self->SUPER::handler($r, @_);
78  
79 }
80  
81 __END__
« lib/WebDyne/Request/PSGI/Static.pm ↑ Summary blib/lib/WebDyne/Request/PSGI/Static.pm »