Scraper/Plugin/ViewMessage.pm

filter: Statementstmt 42.3% 11 / 26 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 3 / 5 Podpod 100% 1 / 1 totaltotal 46.8% 15 / 32 CC 1 SCAR 3.4
CC
1
Cov
42%
scrape
2.0
__ANON__
2.0
BEGIN
1.0
CRAP 1.4
« Scraper/Plugin/NewFriendDiary.pm ↑ Summary Scraper/Plugin/ListBookmark.pm »
1 package WWW::Mixi::Scraper::Plugin::ViewMessage;
2
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use WWW::Mixi::Scraper::Plugin;
Subroutine BEGIN: called CC=1 SCAR=0.0
6
7 1 validator {qw(
8 id is_anything
9 box is_anything
10 )};
11
12 0 ▶sub scrape {
Subroutine scrape: not called CC=1 SCAR=6.9
Pod documented
13 0 my ($self, $html) = @_;
14
15 0 my %scraper;
16 0 ▶ $scraper{message} = scraper {
Subroutine __ANON__: not called CC=1 SCAR=6.9
17 0 process 'div#messageDetail>div.thumb>a',
18 'link' => '@href';
19 0 process 'div#messageDetail>div.thumb>a>img',
20 'image' => '@src',
21 'name' => '@alt';
22 0 process 'div#messageDetail>div.messageDetailHead>h3',
23 'subject' => 'TEXT';
24 0 process 'div#messageDetail>div.messageDetailHead>dl>dd',
25 'heads[]' => 'TEXT';
26 0 process 'div#message_body',
27 'description' => $self->html_or_text;
28 0 result qw( subject name link image description heads );
29 0 };
30
31 0 my $stash = $scraper{message}->scrape(\$html);
32 0 my $time = $stash->{heads}->[0];
33 0 $time =~ s/^.*(\d{4})\D+(\d{2})\D+(\d{2})\D+(\d{2})\D+(\d{2}).*$/$1\-$2\-$3 $4:$5/;
34
35 0 $stash->{time} = $time;
36 0 delete $stash->{heads};
37
38 0 return $self->post_process( $stash )->[0];
39 }
40
41 1 1;
42
43 __END__
« Scraper/Plugin/NewFriendDiary.pm ↑ Summary Scraper/Plugin/ListBookmark.pm »