Wiki/Plugin/Function/Jimakuin.pm

filter: Statementstmt 100% 37 / 37 Branchbran 100% 4 / 4 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 8 / 8 Podpod 100% 4 / 4 totaltotal 100% 56 / 56 CC 4 SCAR 5.5
CC
4
Cov
100%
prepare_args
3.0
prepare_value
2.0
BEGIN
1.0
CRAP 1.7
« Wiki/Plugin/Function/GoogleVideo.pm ↑ Summary Wiki/Plugin/Function/Youtube.pm »
1 package Text::Livedoor::Wiki::Plugin::Function::Jimakuin;
2 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 11 ▶use base qw/Text::Livedoor::Wiki::Plugin::Function/;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 11 ▶use Text::Livedoor::Wiki::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 11 __PACKAGE__->function_name('jimakuin');
7  
8 11 ▶sub prepare_args {
Subroutine prepare_args: called CC=3 SCAR=11.0
Pod documented
9 11 my $class= shift;
10 11 my $args = shift;
11 11 ▶ die 'no arg' unless scalar @$args ;
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @$args 1 10 11
12 10 my $url = $args->[0];
13 10 ▶ die 'url is not invalid' unless $url =~ m{^http://(?:[a-zA-Z0-9\-]+\.)?jimaku\.in/w/([a-zA-Z0-9\_][^/]+)/([a-zA-Z0-9\_][^/]+)}i;
Branch: 1 branch
BranchTrueFalseTotal
unless $url =~ m[^http://(?:[a-zA-Z0-9\-]+\.)?jimaku\.in/w/([a-zA-Z0-9\_][^/]+)/([a-zA-Z0-9\_][^/]+)]i 1 9 10
14 9 my ( $code1 , $code2 ) = $url =~ m{^http://(?:[a-zA-Z0-9\-]+\.)?jimaku\.in/w/([a-zA-Z0-9\_][^/]+)/([a-zA-Z0-9\_][^/]+)};
15 9 return { url => $url , code1 => $code1 , code2 => $code2 };
16 }
17 9 ▶sub prepare_value {
Subroutine prepare_value: called CC=2 SCAR=6.9
Pod documented
18 9 my $class = shift;
19 9 ▶ my $value = shift || '';
Condition100%2/2
shift() || ''
l!l
63
MC/DC100%1/1
shift() || ''
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
20 9 my $width = 425;
21 9 my $height= 380;
22  
23 9 ($width , $height )
24 = Text::Livedoor::Wiki::Utils::get_width_height( $value , { width => $width , height => $height }) ;
25 9 return { width => $width , height => $height };
26 }
27  
28 8 ▶sub process {
Subroutine process: called CC=1 SCAR=0.0
Pod documented
29 8 my ( $class, $inline, $data ) = @_;
30 8 my $url = $data->{args}{url};
31 8 my $code1= $data->{args}{code1};
32 8 my $code2= $data->{args}{code2};
33 8 my $width = $data->{value}{width};
34 8 my $height= $data->{value}{height};
35  
36 8 my $html = <<"END_JIMAKUIN_TMPL";
37 <div class="link_jimakuin">
38 <object width="$width" height="$height">
39 <param name="movie" value="http://swf.jimaku.in/v/$code1/$code2">
40 </param>
41 <param name="wmode" value="transparent"></param>
42 <embed src="http://swf.jimaku.in/v/$code1/$code2"
43 type="application/x-shockwave-flash" wmode="transparent"
44 width="$width" height="$height"></embed></object>
45 </div>
46 END_JIMAKUIN_TMPL
47  
48 8 $html =~ s/\n$//;
49  
50 8 return $html ;
51  
52 }
53  
54 1 ▶sub process_mobile { '' }
Subroutine process_mobile: called CC=1 SCAR=0.0
Pod documented
55  
56 11 1;
57  
58 =head1 NAME
59  
60 Text::Livedoor::Wiki::Plugin::Function::Jimakuin - jimaku.in Function Plugin
61  
62 =head1 DESCRIPTION
63  
64 lets watch and read!
65  
66 =head1 SYNOPSIS
67  
68 &jimakuin(http://jimaku.in/w/kdtdRNTdNb8/oTkZXUNFw_B)
69 &jimakuin(http://jimaku.in/w/kdtdRNTdNb8/oTkZXUNFw_B){100,200}
70 &jimakuin(http://jimaku.in/w/kdtdRNTdNb8/oTkZXUNFw_B){100}
71 &jimakuin(http://jimaku.in/w/kdtdRNTdNb8/oTkZXUNFw_B){,200}
72  
73 =head1 FUNCTION
74  
75 =head2 prepare_args
76  
77 =head2 prepare_value
78  
79 =head2 process
80  
81 =head2 process_mobile
82  
83 =head1 AUTHOR
84  
85 polocky
86  
87 =cut
« Wiki/Plugin/Function/GoogleVideo.pm ↑ Summary Wiki/Plugin/Function/Youtube.pm »