Middleware/DoCoMoGUID.pm

filter: Statementstmt 100% 18 / 18 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 3 / 9 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 71.0% 27 / 38 SCAR 16.8
CC
5
Cov
76%
__ANON__
6.5
BEGIN
1.0
BEGIN
1.0
CRAP 5.4
« Middleware/MethodOverride.pm ↑ Summary Middleware/DebugScreen.pm »
1 package HTTP::Engine::Middleware::DoCoMoGUID;
2 1 ▶use HTTP::Engine::Middleware;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Scalar::Util ();
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use HTML::StickyQuery;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 after_handle {
7 2 ▶ my ( $c, $self, $req, $res ) = @_;
Subroutine __ANON__: called CC=5 SCAR=18.7
8  
9 2 ▶ if ( $res->status == 200
Branch: 1 branch
BranchTrueFalseTotal
if ($res->status == 200 and $res->content_type =~ /html/ and not builtin::blessed($res->body) && $res->body) 2 0 2
Condition33%3/9
$res->status == 200 and $res->content_type =~ /html/ and not builtin::blessed($res->body) && $res->body
!ll&&!rl&&r
002
$res->status == 200 and $res->content_type =~ /html/
!ll&&!rl&&r
002
builtin::blessed($res->body) && $res->body
!ll&&!rl&&r
200
MC/DC0%0/4
$res->status == 200 and $res->content_type =~ /html/ and not builtin::blessed($res->body) && $res->body
$res->status == 200 $res->content_type =~ /html/ builtin::blessed($res->body) $res->body
Truth table20%1/5
A and B and not(C && D)
A= $res->status == 200B= $res->content_type =~ /html/C= builtin::blessed($res->body)D= $res->body
ABCDresult
0XXX0
10XX0
11110
110X1
11101
10 && $res->content_type =~ /html/
11 && not Scalar::Util::blessed $res->body
12 && $res->body )
13 {
14 2 my $body = $res->body;
15 $res->body(
16 sub {
17 2 ▶ my $guid = HTML::StickyQuery->new( 'abs' => 1, );
Subroutine __ANON__: called CC=1 SCAR=0.0
18 2 $guid->sticky(
19 scalarref => \$body,
20 param => { guid => 'ON' },
21 );
22 }
23 2 ->()
24 );
25 }
26  
27 2 $res;
28 1 };
29  
30 1 __MIDDLEWARE__
31  
32 __END__
33  
34 =head1 NAME
35  
36 HTTP::Engine::Middleware::DoCoMoGUID - append guid=ON on each anchor tag
37  
38 =head1 SYNOPSIS
39  
40 This module appends ?guid=ON on each anchor tag.
41 This feature is needed by Japanese mobile web site developers.
42  
43 =head1 AUTHORS
44  
45 tokuhirom
46  
47 yappo
48  
49 =head1 SEE ALSO
50  
51 L<HTML::StickyQuery>
52  
53 =cut
« Middleware/MethodOverride.pm ↑ Summary Middleware/DebugScreen.pm »