| 1 | package Rose::HTML::Object::Message; | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | 44 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||
| 5 | 44 | ▶ | use Carp; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 6 | 44 | ▶ | use Clone::PP; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 7 | 44 | ▶ | use Scalar::Util(); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||
| 9 | 44 | ▶ | use Rose::HTML::Object::Messages qw(CUSTOM_MESSAGE); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||
| 11 | 44 | ▶ | use base 'Rose::Object'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||
| 13 | 44 | our $VERSION = '0.606'; | |||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||
| 15 | #our $Debug = 0; | ||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||
| 17 | use overload | ||||||||||||||||||||||||||||||||
| 18 | 44 | ▶ | ( | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||
| 19 | 0 | ▶ | '""' => sub { shift->text }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 20 | 0 | ▶ | 'bool' => sub { 1 }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | '0+' => sub { 1 }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 22 | 44 | fallback => 1, | |||||||||||||||||||||||||||||||
| 23 | 44 | ); | |||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||
| 25 | use Rose::Object::MakeMethods::Generic | ||||||||||||||||||||||||||||||||
| 26 | 44 | ▶ | ( | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 27 | 44 | scalar => | |||||||||||||||||||||||||||||||
| 28 | [ | ||||||||||||||||||||||||||||||||
| 29 | 'id', | ||||||||||||||||||||||||||||||||
| 30 | 'variant', | ||||||||||||||||||||||||||||||||
| 31 | ], | ||||||||||||||||||||||||||||||||
| 32 | 44 | ); | |||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||
| 34 | 44 | ▶ | sub as_string { no warnings 'uninitialized'; "$_[0]" } | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||
| 36 | sub init | ||||||||||||||||||||||||||||||||
| 37 | 859 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 38 | 859 | my($self) = shift; | |||||||||||||||||||||||||||||||
| 39 | 859 | ▶ | @_ = (text => @_) if(@_ == 1); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 40 | 859 | $self->SUPER::init(@_); | |||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||
| 43 | sub args | ||||||||||||||||||||||||||||||||
| 44 | 2663 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
args: called CC=12 SCAR=28.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 45 | 2663 | my($self) = shift; | |||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||
| 47 | 2663 | ▶ | if(@_) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 48 | { | ||||||||||||||||||||||||||||||||
| 49 | 459 | my %args; | |||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||
| 51 | 459 | ▶ | if(@_ == 1 && ref $_[0] eq 'ARRAY') | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
@_ == 1 and ref $_[0] eq "ARRAY"
MC/DC50%1/2
@_ == 1 and ref $_[0] eq "ARRAY"
@_ == 1
ref $_[0] eq "ARRAY"
Truth table66%2/3
A and B
A= @_ == 1B= ref $_[0] eq "ARRAY"
| |||||||||||||||||||||||||||||||||
| 52 | { | ||||||||||||||||||||||||||||||||
| 53 | 400 | my $i = 1; | |||||||||||||||||||||||||||||||
| 54 | 400 | %args = (map { $i++ => $_ } @{$_[0]}); | |||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||
| 56 | ▶ | elsif(@_ == 1 && ref $_[0] eq 'HASH') | |||||||||||||||||||||||||||||||
|
Condition33%1/3
@_ == 1 and ref $_[0] eq "HASH"
MC/DC0%0/2
@_ == 1 and ref $_[0] eq "HASH"
@_ == 1
ref $_[0] eq "HASH"
Truth table33%1/3
A and B
A= @_ == 1B= ref $_[0] eq "HASH"
| |||||||||||||||||||||||||||||||||
| 57 | { | ||||||||||||||||||||||||||||||||
| 58 | 59 | %args = %{$_[0]}; | |||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||
| 60 | 59 | my $i = 1; | |||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||
| 62 | 59 | foreach my $key (sort keys %args) | |||||||||||||||||||||||||||||||
| 63 | { | ||||||||||||||||||||||||||||||||
| 64 | 84 | ▶ | $args{$i} = $args{$key} unless(exists $args{$i}); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 65 | 84 | $i++; | |||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||
| 68 | else | ||||||||||||||||||||||||||||||||
| 69 | { | ||||||||||||||||||||||||||||||||
| 70 | 0 | my $i = 1; | |||||||||||||||||||||||||||||||
| 71 | 0 | %args = map { $i++ => $_ } @_; | |||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||
| 74 | 459 | $self->{'args'} = \%args; | |||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | return wantarray ? %{$self->{'args'}} : $self->{'args'}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | return wantarray ? %{$self->{'args'} || {}} : ($self->{'args'} ||= {}); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%2/4
$self->{'args'} || {}
$self->{"args"} ||= {}
MC/DC0%0/1
$self->{'args'} || {}
$self->{'args'}
MC/DC100%1/1
$self->{"args"} ||= {}
$self->{"args"}
Truth table0%0/2
A
A= $self->{'args'}
Truth table100%2/2
A
A= $self->{"args"}
| |||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||
| 82 | sub parent | ||||||||||||||||||||||||||||||||
| 83 | 8165 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
parent: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 84 | 8165 | my($self) = shift; | |||||||||||||||||||||||||||||||
| 85 | 8165 | ▶ | return Scalar::Util::weaken($self->{'parent'} = shift) if(@_); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 86 | 6961 | return $self->{'parent'}; | |||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||
| 89 | sub clone | ||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
clone: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 91 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||
| 92 | 0 | my $clone = Clone::PP::clone($self); | |||||||||||||||||||||||||||||||
| 93 | 0 | $clone->parent(undef); | |||||||||||||||||||||||||||||||
| 94 | 0 | return $clone; | |||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||
| 97 | sub text | ||||||||||||||||||||||||||||||||
| 98 | 2254 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
text: called CC=3 SCAR=11.4
Pod
documented
| |||||||||||||||||||||||||||||||||
| 99 | 2254 | my($self) = shift; | |||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||
| 101 | 2254 | ▶ | if(@_) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 102 | { | ||||||||||||||||||||||||||||||||
| 103 | 399 | ▶ | if(UNIVERSAL::isa($_[0], __PACKAGE__)) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 104 | { | ||||||||||||||||||||||||||||||||
| 105 | 0 | $self->id($_[0]->id); | |||||||||||||||||||||||||||||||
| 106 | 0 | return $self->{'text'} = $_[0]->text; | |||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||
| 109 | 399 | $self->id(CUSTOM_MESSAGE); | |||||||||||||||||||||||||||||||
| 110 | 399 | return $self->{'text'} = $_[0]; | |||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||
| 113 | 1855 | return $self->{'text'}; | |||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||
| 116 | 44 | ▶ | sub is_custom { no warnings; shift->id == CUSTOM_MESSAGE } | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
is_custom: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||
| 118 | 44 | 1; | |||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||
| 120 | __END__ | ||||||||||||||||||||||||||||||||