Wiki/Plugin/Inline/Function.pm

filter: Statementstmt 100% 25 / 25 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 100% 36 / 36 CC 4 SCAR 10.0
CC
4
Cov
100%
process
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.7
« Wiki/Plugin/Function/Fukidashi.pm ↑ Summary Wiki/Plugin/Inline/WikiPage.pm »
1 package Text::Livedoor::Wiki::Plugin::Inline::Function;
2  
3 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 10 ▶use base qw(Text::Livedoor::Wiki::Plugin::Inline);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 10 __PACKAGE__->regex(q{([&#]([a-zA-Z]+)\([\s]*([^\)]*)\))((?:\{(?:[^\{\}]|(?:\{(?:[^\{\}]|(?:\{[^\{\}]*\}))*\}))*\})?)});
8 10 __PACKAGE__->n_args(4);
9  
10 152 ▶sub process {
Subroutine process: called CC=4 SCAR=13.9
Pod documented
11 152 my ( $class , $inline, $head_part, $function_name, $opr, $tail_part ) = @_;
12 152 my $original = $head_part . $tail_part;
13 152 ▶ $tail_part = $1 if ( $tail_part =~ /^\{(.*)\}$/ );
Branch: 1 branch
BranchTrueFalseTotal
if $tail_part =~ /^\{(.*)\}$/ 96 56 152
14 # trim
15 152 $opr =~ s/^\s+//;
16 152 $opr =~ s/\s+$//;
17  
18 152 $tail_part =~ s/^\s+//;
19 152 $tail_part =~ s/\s+$//;
20  
21 152 ▶ unless ( $inline->function->has_function( $function_name ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($inline->function->has_function($function_name)) 1 151 152
22 1 return Text::Livedoor::Wiki::Utils::escape_more($original);
23 }
24  
25 151 my $data = $inline->function->prepare( $function_name , $opr , $tail_part );
26 151 ▶ unless( $data ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($data) 25 126 151
27 25 return Text::Livedoor::Wiki::Utils::escape_more( $original );
28 }
29  
30 126 return $inline->function->parse( $function_name , $data );
31 }
32  
33 10 1;
34  
35 =head1 NAME
36  
37 Text::Livedoor::Wiki::Plugin::Inline::Function - Inline Function Plugin
38  
39 =head1 DESCRIPTION
40  
41 This is a very special plugin which called function plugins.
42  
43 =head1 SYNOPSIS
44  
45 &functionname(){hoge}
46 #functionname(){hoge}
47  
48 =head1 FUNCTION
49  
50 =head2 process
51  
52 =head1 AUTHOR
53  
54 polocky
55  
56 =cut
« Wiki/Plugin/Function/Fukidashi.pm ↑ Summary Wiki/Plugin/Inline/WikiPage.pm »