| 1 | package HTML::Template::Pro::Extension::CSTART; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 1 | $VERSION = "0.11"; | |||||||||||||||||||
| 4 | 0 | ▶ | sub Version { $VERSION; } | ||||||||||||||||||
|
Subroutine
Version: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 1 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 1 | my %fields_parent = | |||||||||||||||||||
| 10 | ( | ||||||||||||||||||||
| 11 | ecp_compatibility_mode => 0, | ||||||||||||||||||||
| 12 | ); | ||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 1 | my $re_var = q{ | |||||||||||||||||||
| 15 | <\s* | ||||||||||||||||||||
| 16 | [Tt][Mm][Pp][Ll]_[Cc][Ss][Tt][Aa][Rr][Tt] | ||||||||||||||||||||
| 17 | \s*> | ||||||||||||||||||||
| 18 | (.*?) | ||||||||||||||||||||
| 19 | <\s*\/[Tt][Mm][Pp][Ll]_[Cc][Ss][Tt][Aa][Rr][Tt]\s*>}; | ||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 1 | ▶ | sub init { | ||||||||||||||||||
|
Subroutine
init: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||||||||||||
| 23 | 1 | my $self = shift; | |||||||||||||||||||
| 24 | 1 | ▶ | while (my ($key,$val) = each(%fields_parent)) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 25 | 1 | ▶ | $self->{$key} = $self->{$key} || $val; | ||||||||||||||||||
|
Condition33%1/3
$self->{$key} || $val
MC/DC0%0/2
$self->{$key} || $val
$self->{$key}
$val
Truth table33%1/3
A || B
A= $self->{$key}B= $val
| |||||||||||||||||||||
| 26 | } | ||||||||||||||||||||
| 27 | } | ||||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | 1 | ▶ | sub get_filter { | ||||||||||||||||||
|
Subroutine
get_filter: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 30 | 1 | my $self = shift; | |||||||||||||||||||
| 31 | 1 | return _get_filter($self); | |||||||||||||||||||
| 32 | } | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | 1 | ▶ | sub _get_filter { | ||||||||||||||||||
|
Subroutine
_get_filter: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 35 | 1 | my $self = shift; | |||||||||||||||||||
| 36 | 1 | my @ret ; | |||||||||||||||||||
| 37 | # Sorry for this :->. I've an e-commerce project called ecp that | ||||||||||||||||||||
| 38 | # use a CSTART modified syntax using html comment | ||||||||||||||||||||
| 39 | 1 | ▶ | push @ret,\&_ecp_cstart if ($self->{ecp_compatibility_mode}); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 40 | # Standard CSTART syntax | ||||||||||||||||||||
| 41 | 1 | push @ret,\&_cstart; | |||||||||||||||||||
| 42 | 1 | return @ret; | |||||||||||||||||||
| 43 | } | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | # funzione filtro per aggiungere il tag <TMPL_CSTART> | ||||||||||||||||||||
| 47 | # da tenere fintanto che la nostra patch non sia inserita nella | ||||||||||||||||||||
| 48 | # distribuzione standard del modulo | ||||||||||||||||||||
| 49 | 1 | ▶ | sub _cstart { | ||||||||||||||||||
|
Subroutine
_cstart: called CC=3 SCAR=11.0
| |||||||||||||||||||||
| 50 | 1 | my $template = shift; | |||||||||||||||||||
| 51 | 1 | my $ret = ''; | |||||||||||||||||||
| 52 | 1 | ▶ | while ($$template =~m{$re_var}xsg) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 53 | 2 | $ret .= $1; | |||||||||||||||||||
| 54 | } | ||||||||||||||||||||
| 55 | 1 | ▶ | $$template = $ret eq '' ? $$template : $ret; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 56 | } | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | 0 | ▶ | sub _ecp_cstart { | ||||||||||||||||||
|
Subroutine
_ecp_cstart: not called CC=2 SCAR=17.9
| |||||||||||||||||||||
| 59 | 0 | my $template = shift; | |||||||||||||||||||
| 60 | 0 | my $brem ='<!' . '--'; | |||||||||||||||||||
| 61 | 0 | my $eend ='--' . '>'; | |||||||||||||||||||
| 62 | 0 | my $start = qq=$brem\\s*[Cc][Ss][Tt][Aa][Rr][Tt]\\s*$eend=; | |||||||||||||||||||
| 63 | 0 | my $end = qq=$brem\\s*[Cc][Ee][Nn][Dd]\\s*$eend=; | |||||||||||||||||||
| 64 | 0 | ▶ | if ($$template =~/$end/) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 65 | 0 | $$template =~s|$start|<TMPL_CSTART>|g; | |||||||||||||||||||
| 66 | 0 | $$template =~s|$end|</TMPL_CSTART>|g; | |||||||||||||||||||
| 67 | } | ||||||||||||||||||||
| 68 | } | ||||||||||||||||||||
| 69 | |||||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | 1 | 1; | |||||||||||||||||||