| 1 | package Pod::Simple::PullParserStartToken; | ||||||||||||||||||||
| 2 | 10 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 10 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 10 | ▶ | use Pod::Simple::PullParserToken (); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 10 | our @ISA = ('Pod::Simple::PullParserToken'); | |||||||||||||||||||
| 6 | 10 | our $VERSION = '3.48'; | |||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 349 | ▶ | sub new { # Class->new(tagname, optional_attrhash); | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=8.1
Pod
undocumented
| |||||||||||||||||||||
| 9 | 349 | my $class = shift; | |||||||||||||||||||
| 10 | 349 | ▶ | return bless ['start', @_], ref($class) || $class; | ||||||||||||||||||
|
Condition33%1/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table33%1/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||
| 11 | } | ||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | # Purely accessors: | ||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 474 | ▶ | sub tagname { (@_ == 2) ? ($_[0][1] = $_[1]) : $_[0][1] } | ||||||||||||||||||
|
Subroutine
tagname: called CC=2 SCAR=7.6
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||
| 16 | 3 | ▶ | sub tag { shift->tagname(@_) } | ||||||||||||||||||
|
Subroutine
tag: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 2 | ▶ | sub is_tagname { $_[0][1] eq $_[1] } | ||||||||||||||||||
|
Subroutine
is_tagname: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 19 | 0 | ▶ | sub is_tag { shift->is_tagname(@_) } | ||||||||||||||||||
|
Subroutine
is_tag: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 0 | ▶ | sub attr_hash { $_[0][2] ||= {} } | ||||||||||||||||||
|
Subroutine
attr_hash: not called CC=2 SCAR=17.9
Pod
documented
Condition0%0/2
$_[0][2] ||= {}
MC/DC0%0/1
$_[0][2] ||= {}
$_[0][2]
Truth table0%0/2
A
A= $_[0][2]
| |||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 82 | ▶ | sub attr { | ||||||||||||||||||
|
Subroutine
attr: called CC=5 SCAR=25.7
Pod
documented
| |||||||||||||||||||||
| 25 | 82 | ▶ | if(@_ == 2) { # Reading: $token->attr('attrname') | ||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||
| 26 | 82 | ▶ | ${$_[0][2] || return undef}{ $_[1] }; | ||||||||||||||||||
|
Condition50%1/2
$_[0][2] || (return undef)
MC/DC0%0/1
$_[0][2] || (return undef)
$_[0][2]
Truth table50%1/2
A
A= $_[0][2]
| |||||||||||||||||||||
| 27 | } elsif(@_ > 2) { # Writing: $token->attr('attrname', 'newval') | ||||||||||||||||||||
| 28 | 0 | ▶ | ${$_[0][2] ||= {}}{ $_[1] } = $_[2]; | ||||||||||||||||||
|
Condition0%0/2
$_[0][2] ||= {}
MC/DC0%0/1
$_[0][2] ||= {}
$_[0][2]
Truth table0%0/2
A
A= $_[0][2]
| |||||||||||||||||||||
| 29 | } else { | ||||||||||||||||||||
| 30 | 0 | require Carp; | |||||||||||||||||||
| 31 | 0 | Carp::croak( | |||||||||||||||||||
| 32 | 'usage: $object->attr("val") or $object->attr("key", "newval")'); | ||||||||||||||||||||
| 33 | 0 | return undef; | |||||||||||||||||||
| 34 | } | ||||||||||||||||||||
| 35 | } | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | 10 | 1; | |||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | __END__ | ||||||||||||||||||||