blib/lib/Text/MicroMason/HTMLMason.pm

filter: Statementstmt 100% 15 / 15 Branchbran 92.8% 13 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 3 / 3 totaltotal 97.2% 35 / 36 CC 8 SCAR 14.6
CC
8
Cov
97%
lex_token
6.0
assemble_args
3.0
BEGIN
1.0
CRAP 4.3
« blib/lib/Text/MicroMason/PostProcess.pm ↑ Summary blib/lib/Text/MicroMason/Cache/File.pm »
1 package Text::MicroMason::HTMLMason;
2  
3 36 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 ######################################################################
6  
7 36 my $re_eol = "(?:\\r\\n|\\r|\\n|\\z)";
8 36 my $re_sol = "(?:\\A|(?<=\\r|\\n) )";
9 36 my $re_tag = "perl|args|once|init|cleanup|doc|text|expr|file";
10  
11 # ( $type, $value ) = $mason->lex_token();
12 976 ▶sub lex_token {
Subroutine lex_token: called CC=6 SCAR=18.0
Pod documented
13 # Blocks in <%word> ... <%word> tags.
14 976 ▶ /\G \<\%($re_tag)\> (.*?) \<\/\%\1\> $re_eol? /xcogs ? ( $1 => $2 ) :
Branch: 5 branches
BranchTrueFalseTotal
m[\G \<\%($re_tag)\> (.*?) \</\%\1\> $re_eol? ]cgosx ? : 123 853 976
/\G \<\% ( .*? ) \%\> /cgosx ? : 250 603 853
/\G \<\& ( .*? ) \&\> /cgosx ? : 19 584 603
/\G $re_sol \% ( [^\n\r]* ) $re_eol /cgosx ? : 109 475 584
/\G ( (?: [^\<\r\n%]+ | \<(?!\%|\&) | (?<=[^\r\n\<])% | $re_eol (?:\z|[^\r\n\%\<]|(?=\r\n|\r|\n|\%)|\<[^\%\&]|(?=\<[\%\&])) )+ (?: $re_eol +(?:\z|(?=\%|\<\[\%\&])) )? ) /cgosx ? : 475 0 475
15
16 # Blocks in <% ... %> tags.
17 /\G \<\% ( .*? ) \%\> /xcogs ? ( 'expr' => $1 ) :
18
19 # Blocks in <& ... &> tags.
20 /\G \<\& ( .*? ) \&\> /xcogs ? ( 'file' => $1 ) :
21
22 # Lines begining with %
23 /\G $re_sol \% ( [^\n\r]* ) $re_eol /xcogs ? ( 'perl' => $1 ) :
24
25 # Things that don't match the above
26 /\G ( (?: [^\<\r\n%]+ | \<(?!\%|\&) | (?<=[^\r\n\<])% |
27 $re_eol (?:\z|[^\r\n\%\<]|(?=\r\n|\r|\n|\%)|\<[^\%\&]|(?=\<[\%\&]))
28 )+ (?: $re_eol +(?:\z|(?=\%|\<\[\%\&])) )?
29 ) /xcogs ? ( 'text' => $1 ) :
30  
31 # Lexer error
32 ()
33 }
34  
35 ######################################################################
36  
37 # Text elements used for subroutine assembly
38 297 ▶sub assembler_rules {
Subroutine assembler_rules: called CC=1 SCAR=0.0
Pod documented
39 297 my $self = shift;
40 297 $self->NEXT('assembler_rules'),
41 template => [ qw( @once $sub_start $init_errs $init_output $init_args
42 @init @perl !@cleanup $return_output $sub_end -@doc ) ]
43 }
44  
45 25 ▶sub assemble_args {
Subroutine assemble_args: called CC=3 SCAR=11.0
Pod documented
46 25 my ( $self, $token ) = @_;
47 25 $token =~ s/^\s*([\$\@\%])(\w+) (?:\s* => \s* ([^\r\n]+))?/
48 36 ▶ my $argvar = ($1 eq '$') ? "\$ARGS{$2}" : "$1\{ \$ARGS{$2} }";
Branch: 1 branch
BranchTrueFalseTotal
$1 eq '$' ? : 28 8 36
49 36 ▶ "my $1$2 = exists \$ARGS{$2} ? $argvar : " .
Branch: 1 branch
BranchTrueFalseTotal
defined $3 ? : 20 16 36
50 ( defined($3) ? "($argvar = $3\n)" :
51 qq{Carp::croak("no value sent for required parameter '$2'")} ) .
52 ";"/gexm;
53 25 return ( 'init' => '($#_ % 2) or Carp::croak("Odd number of parameters passed to sub expecting name/value pairs"); ' . "\n" . $token );
54 }
55  
56 ######################################################################
57  
58 36 1;
59  
60 __END__
« blib/lib/Text/MicroMason/PostProcess.pm ↑ Summary blib/lib/Text/MicroMason/Cache/File.pm »