| 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
| |||||||||||
| 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
| |||||||||||
| 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__ | ||||||||||