lib/Text/Xatena/Inline/Aggressive.pm

filter: Statementstmt 96.7% 30 / 31 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 4 totaltotal 85.7% 42 / 49 CC 3 SCAR 3.1
CC
3
Cov
91%
ua
2.1
title_of
2.1
BEGIN
1.0
CRAP 1.4
« lib/Text/Xatena/Node/Comment.pm ↑ Summary blib/lib/Text/Xatena/Util.pm »
1 package Text::Xatena::Inline::Aggressive;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use URI::Escape;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use LWP::Simple qw($ua);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use HTML::Entities;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Text::Xatena::Inline -Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 12 ▶sub cache { $_[0]->{cache} }
Subroutine cache: called CC=1 SCAR=0.0
Pod undocumented
11 6 ▶sub ua { $_[0]->{ua} || $ua }
Subroutine ua: called CC=2 SCAR=7.6
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"ua"} or $Text::Xatena::Inline::Aggressive::ua 0 6 6
12  
13 21 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
14 21 my ($class, @args) = @_;
15 21 my $self = $class->SUPER::new(@args);
16 21 $self->{aggressive} = 1;
17 21 $self;
18 }
19  
20 6 ▶sub title_of {
Subroutine title_of: called CC=2 SCAR=7.2
Pod undocumented
21 6 my ($self, $uri) = @_;
22 6 my $res = $self->ua->get($uri);
23 6 ▶ if ($res->is_success) {
Branch: 1 branch
BranchTrueFalseTotal
if ($res->is_success) { } 6 0 6
24 6 my ($title) = ($res->decoded_content =~ qr|<title[^>]*>([^<]*)</title>|i);
25 6 $title;
26 } else {
27 0 $res->status_line;
28 }
29 }
30  
31 2 1;
32 __END__
« lib/Text/Xatena/Node/Comment.pm ↑ Summary blib/lib/Text/Xatena/Util.pm »