| 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)
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')
| |||||||||||||
| 54 | 7 | ▶ | my $self=$self_cr->() || return; | ||||||||||
|
Condition50%1/2
&$self_cr() || (return)
MC/DC0%0/1
&$self_cr() || (return)
&$self_cr()
Truth table50%1/2
A
A= &$self_cr()
| |||||||||||||
| 55 | 7 | ▶ | my %param=(@param == 1) ? (cache => @param) : @param; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 56 | 7 | ▶ | my $meta_hr=$self->meta() || return err(); | ||||||||||
|
Condition50%1/2
$self->meta || (return err())
MC/DC0%0/1
$self->meta || (return err())
$self->meta
Truth table50%1/2
A
A= $self->meta
| |||||||||||||
| 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 ?'))
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')
| |||||||||||||
| 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__ | ||||||||||||