| 1 | package Net::NicoVideo::Content::MylistItem; | ||||||||||||||||||||||||||||||||||||||||||
| 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 vars qw($VERSION); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | $VERSION = '0.28'; | |||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use base qw(Net::NicoVideo::Content Class::Accessor::Fast); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use HTML::Parser 3.00; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use vars qw(@Members); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | @Members = qw( | |||||||||||||||||||||||||||||||||||||||||
| 13 | item_type | ||||||||||||||||||||||||||||||||||||||||||
| 14 | item_id | ||||||||||||||||||||||||||||||||||||||||||
| 15 | description | ||||||||||||||||||||||||||||||||||||||||||
| 16 | token | ||||||||||||||||||||||||||||||||||||||||||
| 17 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | __PACKAGE__->mk_accessors(@Members); | |||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | sub members { # implement | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
members: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | my @copy = @Members; | |||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | @copy; | |||||||||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | sub parse { # implement | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | $self->load($_[0]) if( defined $_[0] ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | my $content = $self->_decoded_content; | |||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | # take NicoAPI.token | ||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | if( $content =~ /NicoAPI\.token\s*=\s*"([-\w]+)"/ ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | $self->token( $1 ); | |||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | # take item_type and item_id using HTML::Parser | ||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | my $item_type = undef; | |||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | my $item_id = undef; | |||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | my $description = undef; | |||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | my $p; | |||||||||||||||||||||||||||||||||||||||||
| 42 | $p = HTML::Parser->new( | ||||||||||||||||||||||||||||||||||||||||||
| 43 | api_version => 3, | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | start_h => [ sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=11 SCAR=48.8
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | my ($tagname, $attr) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | if( lc($tagname) eq 'input' ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | if( exists $attr->{name} and lc($attr->{name}) eq 'item_type' ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $attr->{"name"} and lc $attr->{"name"} eq "item_type"
MC/DC0%0/2
exists $attr->{"name"} and lc $attr->{"name"} eq "item_type"
exists $attr->{"name"}
lc $attr->{"name"} eq "item_type"
Truth table0%0/3
A and B
A= exists $attr->{"name"}B= lc $attr->{"name"} eq "item_type"
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | $item_type = $attr->{value}; | |||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | if( exists $attr->{name} and lc($attr->{name}) eq 'item_id' ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $attr->{"name"} and lc $attr->{"name"} eq "item_id"
MC/DC0%0/2
exists $attr->{"name"} and lc $attr->{"name"} eq "item_id"
exists $attr->{"name"}
lc $attr->{"name"} eq "item_id"
Truth table0%0/3
A and B
A= exists $attr->{"name"}B= lc $attr->{"name"} eq "item_id"
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | $item_id = $attr->{value}; | |||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | if( exists $attr->{name} and lc($attr->{name}) eq 'description' ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $attr->{"name"} and lc $attr->{"name"} eq "description"
MC/DC0%0/2
exists $attr->{"name"} and lc $attr->{"name"} eq "description"
exists $attr->{"name"}
lc $attr->{"name"} eq "description"
Truth table0%0/3
A and B
A= exists $attr->{"name"}B= lc $attr->{"name"} eq "description"
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | $description= $attr->{value}; | |||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | $p->eof if( defined $item_type and defined $item_id and defined $description ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $item_type and defined $item_id and defined $description
defined $item_type and defined $item_id
MC/DC0%0/3
defined $item_type and defined $item_id and defined $description
defined $item_type
defined $item_id
defined $description
Truth table0%0/4
A and B and C
A= defined $item_typeB= defined $item_idC= defined $description
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | }, 'tagname, attr']); | |||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | $p->parse($content); | |||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | $self->item_type( $item_type ); | |||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | $self->item_id( $item_id ); | |||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | $self->description( $description ); | |||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | # status | ||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | ▶ | if( defined $self->item_id and defined $self->item_type ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $self->item_id and defined $self->item_type
MC/DC0%0/2
defined $self->item_id and defined $self->item_type
defined $self->item_id
defined $self->item_type
Truth table0%0/3
A and B
A= defined $self->item_idB= defined $self->item_type
| |||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | $self->set_status_success; | |||||||||||||||||||||||||||||||||||||||||
| 67 | }else{ | ||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | $self->set_status_error; | |||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 76 | __END__ | ||||||||||||||||||||||||||||||||||||||||||