Object.pm

filter: Statementstmt 80.4% 152 / 189 Branchbran 38.4% 30 / 78 Conditioncond 38.4% 10 / 26 MC/DCmcdc 0.0% 0 / 14 Subroutinesub 86.0% 37 / 43 Podpod 87.5% 21 / 24 totaltotal 66.8% 250 / 374 CC 56 SCAR 22.3
CC
56
Cov
66%
read_string
56.0
read_file
12.3
__ANON__
12.0
CRAP 9.3
« Object/Value.pm ↑ Summary Object/Element.pm »
1 ##----------------------------------------------------------------------------
2 ## CSS Object Oriented - ~/lib/CSS/Object.pm
3 ## Version v0.2.1
4 ## Copyright(c) 2024 DEGUEST Pte. Ltd.
5 ## Author: Jacques Deguest <jack@deguest.jp>
6 ## Created 2020/06/24
7 ## Modified 2026/07/05
8 ## All rights reserved
9 ##
10 ## This program is free software; you can redistribute it and/or modify it
11 ## under the same terms as Perl itself.
12 ##----------------------------------------------------------------------------
13 package CSS::Object;
14 BEGIN
15 6 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.0
16 6 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 6 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 6 ▶ use warnings::register;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 6 ▶ use parent qw( Module::Generic );
Subroutine BEGIN: called CC=1 SCAR=0.0
20 6 ▶ use CSS::Object::Builder;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 6 ▶ use CSS::Object::Comment;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 6 ▶ use CSS::Object::Format;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 6 ▶ use CSS::Object::Property;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 6 ▶ use CSS::Object::Rule;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 6 ▶ use CSS::Object::Rule::At;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 6 ▶ use CSS::Object::Rule::Keyframes;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 6 ▶ use CSS::Object::Selector;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 6 ▶ use CSS::Object::Value;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 6 ▶ use Wanted ();
Subroutine BEGIN: called CC=1 SCAR=0.0
30 6 our $VERSION = 'v0.2.1';
31 };
32  
33 sub init
34 6 ▶{
Subroutine init: called CC=3 SCAR=11.0
Pod documented
35 6 my $self = shift( @_ );
36 6 $self->{parser} = 'CSS::Object::Parser::Default';
37 6 $self->{format} = '';
38 6 $self->{_init_strict_use_sub} = 1;
39 6 ▶ $self->SUPER::init( @_ ) || return( $self->pass_error );
Branch: 1 branch
BranchTrueFalseTotal
$self->SUPER::init(@_) or return $self->pass_error 6 0 6
40 6 ▶ unless( $self->_is_a( $self->{format}, 'CSS::Object::Format' ) )
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->_is_a($self->{"format"}, "CSS::Object::Format")) 3 3 6
41 {
42 3 my $format = CSS::Object::Format->new(
43 debug => $self->debug
44 );
45 3 $self->format( $format );
46 }
47 6 $self->{rules} = Module::Generic::Array->new;
48 6 return( $self );
49 }
50  
51 # Add comment at the top level. To add comment inside a rule, see add_element in CSS::Object::Rule
52 sub add_element
53 1 ▶{
Subroutine add_element: called CC=3 SCAR=11.2
Pod documented
54 1 my $self = shift( @_ );
55 1 ▶ my $elem = shift( @_ ) || return( $self->error( "No element object was provided to add to this rule." ) );
Condition50%1/2
shift @_ || (return $self->error('No element object was provided to add to this rule.'))
l!l
10
MC/DC0%0/1
shift @_ || (return $self->error('No element object was provided to add to this rule.'))
shift @_
Truth table50%1/2
A
A= shift @_
Aresult
11
00
56 1 ▶ return( $self->error( "Element object provided ($elem) is not a CSS::Object::Element object." ) ) if( !$self->_is_a( $elem, 'CSS::Object::Element' ) );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_is_a($elem, "CSS::Object::Element") 0 1 1
57 # $elem->format( $self->format );
58 1 $elem->debug( $self->debug );
59 # $self->properties->push( $prop );
60 1 $self->elements->push( $elem );
61 1 return( $self );
62 }
63  
64 sub add_rule
65 9 ▶{
Subroutine add_rule: called CC=3 SCAR=11.2
Pod documented
66 9 my $self = shift( @_ );
67 9 my $rule = shift( @_ );
68 9 ▶ return( $self->error( "No rule object was provided to add." ) ) if( !defined( $rule ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $rule 0 9 9
69 9 ▶ return( $self->error( "Object provided is not a CSS::Object::Rule object." ) ) if( !$self->_is_a( $rule, 'CSS::Object::Rule' ) );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_is_a($rule, "CSS::Object::Rule") 0 9 9
70 # $self->rules->push( $rule );
71 9 $self->elements->push( $rule );
72 9 return( $rule );
73 }
74  
75 sub as_string
76 2 ▶{
Subroutine as_string: called CC=4 SCAR=19.1
Pod documented
77 2 my $self = shift( @_ );
78 2 ▶ if( @_ )
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 2 2
79 {
80 0 my $format = shift( @_ );
81 0 ▶ return( $self->error( "Provided parameter to as_string was not an CSS::Object::Format object." ) ) if( $format !~ /^CSS\::Object\::Format/ && !$self->_is_a( $format, 'CSS::Object::Format' ) );
Branch: 1 branch
BranchTrueFalseTotal
unless $format =~ /^CSS\::Object\::Format/ or $self->_is_a($format, "CSS::Object::Format") 0 0 0
Condition0%0/3
$format =~ /^CSS\::Object\::Format/ or $self->_is_a($format, "CSS::Object::Format")
l!l&&r!l&&!r
000
MC/DC0%0/2
$format =~ /^CSS\::Object\::Format/ or $self->_is_a($format, "CSS::Object::Format")
$format =~ /^CSS\::Object\::Format/ $self->_is_a($format, "CSS::Object::Format")
Truth table0%0/3
A or B
A= $format =~ /^CSS\::Object\::Format/B= $self->_is_a($format, "CSS::Object::Format")
ABresult
1X1
011
000
82 $self->elements->foreach(sub
83 0 ▶ {
Subroutine __ANON__: not called CC=1 SCAR=6.9
84 0 shift->format( $format );
85 0 });
86 }
87  
88 2 my $output = Module::Generic::Array->new;
89 # $self->rules->foreach(sub
90 $self->elements->foreach(sub
91 4 ▶ {
Subroutine __ANON__: called CC=1 SCAR=0.0
92 4 $output->push( shift->as_string );
93 2 });
94 2 my $nl = $self->format->new_line;
95 2 return( $output->join( "$nl$nl" )->scalar );
96 }
97  
98 sub builder
99 1 ▶{
Subroutine builder: called CC=3 SCAR=11.3
Pod documented
100 1 my $self = shift( @_ );
101 1 ▶ return( $self->{_builder} ) if( $self->_is_object( $self->{_builder} ) );
Branch: 1 branch
BranchTrueFalseTotal
if $self->_is_object($self->{"_builder"}) 0 1 1
102 1 ▶ my $b = CSS::Object::Builder->new( $self, debug => $self->debug ) ||
Condition50%1/2
'CSS::Object::Builder'->new($self, 'debug', $self->debug) || (return $self->error('Could not initialise the CSS builder: ', 'CSS::Object::Builder'->error))
l!l
10
MC/DC0%0/1
'CSS::Object::Builder'->new($self, 'debug', $self->debug) || (return $self->error('Could not initialise the CSS builder: ', 'CSS::Object::Builder'->error))
'CSS::Object::Builder'->new($self, 'debug', $self->debug)
Truth table50%1/2
A
A= 'CSS::Object::Builder'->new($self, 'debug', $self->debug)
Aresult
11
00
103 return( $self->error( "Could not initialise the CSS builder: ", CSS::Object::Builder->error ) );
104 1 $self->{_builder} = $b;
105 1 return( $b );
106 }
107  
108 1 ▶sub charset { return( shift->_set_get_scalar_as_object( 'charset', @_ ) ); }
Subroutine charset: called CC=1 SCAR=0.0
Pod documented
109  
110 # Array of CSS::Object::Element objects or their sub classes
111 25 ▶sub elements { return( shift->_set_get_object_array_object( 'elements', 'CSS::Object::Element', @_ ) ); }
Subroutine elements: called CC=1 SCAR=0.0
Pod documented
112  
113 sub format
114 105 ▶{
Subroutine format: called CC=8 SCAR=24.5
Pod documented
115 105 my $self = shift( @_ );
116 105 ▶ if( @_ )
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 6 99 105
117 {
118 6 my $val = shift( @_ );
119 6 my $format;
120 6 ▶ if( ref( $val ) )
Branch: 2 branches
BranchTrueFalseTotal
if (ref $val) { } 3 3 6
elsif (not ref $val and index($val, '::') != -1) { } 3 0 3
121 {
122 3 ▶ $format = $self->_set_get_object( 'format', 'CSS::Object::Format', $val ) || return( $self->pass_error );
Condition50%1/2
$self->_set_get_object('format', 'CSS::Object::Format', $val) || (return $self->pass_error)
l!l
30
MC/DC0%0/1
$self->_set_get_object('format', 'CSS::Object::Format', $val) || (return $self->pass_error)
$self->_set_get_object('format', 'CSS::Object::Format', $val)
Truth table50%1/2
A
A= $self->_set_get_object('format', 'CSS::Object::Format', $val)
Aresult
11
00
123 }
124 # Formatter as a class name
125 ▶ elsif( !ref( $val ) && CORE::index( $val, '::' ) != -1 )
Condition33%1/3
not ref $val and index($val, "::") != -1
!ll&&!rl&&r
003
MC/DC0%0/2
not ref $val and index($val, "::") != -1
not ref $val index($val, "::") != -1
Truth table33%1/3
not(A) and B
A= not ref $valB= index($val, "::") != -1
ABresult
0X0
100
111
126 {
127 3 ▶ $self->_load_class( $val ) || return( $self->pass_error );
Branch: 1 branch
BranchTrueFalseTotal
$self->_load_class($val) or return $self->pass_error 3 0 3
128 3 ▶ $format = $val->new( debug => $self->debug ) || return( $self->pass_error( $val->error ) );
Condition50%1/2
$val->new('debug', $self->debug) || (return $self->pass_error($val->error))
l!l
30
MC/DC0%0/1
$val->new('debug', $self->debug) || (return $self->pass_error($val->error))
$val->new('debug', $self->debug)
Truth table50%1/2
A
A= $val->new('debug', $self->debug)
Aresult
11
00
129 3 $self->_set_get_object( 'format', 'CSS::Object::Format', $format );
130 }
131 else
132 {
133 0 return( $self->error( "Unknown format \"$val\". I do not know what to do with it." ) );
134 }
135 $self->elements->foreach(sub
136 0 ▶ {
Subroutine __ANON__: not called CC=3 SCAR=24.8
137 0 ▶ return(1) if( !$self->_is_object( $_[0] ) );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_is_object($_[0]) 0 0 0
138 0 ▶ shift->format( $format ) || return;
Branch: 1 branch
BranchTrueFalseTotal
(shift())->format($format) or return 0 0 0
139 6 });
140 6 return( $format );
141 }
142 99 return( $self->_set_get_object( 'format', 'CSS::Object::Format' ) );
143 }
144  
145 sub get_rule_by_selector
146 1 ▶{
Subroutine get_rule_by_selector: called CC=9 SCAR=24.3
Pod documented
147 1 my( $self, $name ) = @_;
148 1 ▶ return( $self->error( "No selector was provided to find its equivalent rule object." ) ) if( !$name );
Branch: 1 branch
BranchTrueFalseTotal
unless $name 0 1 1
149 1 my $found = Module::Generic::Array->new;
150 1 foreach my $rule ( @{$self->elements} )
151 {
152 3 ▶ next if( !$rule->isa( 'CSS::Object::Rule' ) );
Branch: 1 branch
BranchTrueFalseTotal
unless $rule->isa("CSS::Object::Rule") 0 3 3
153 3 foreach my $sel ( @{$rule->selectors} )
154 {
155 5 ▶ if( $sel->name eq $name )
Branch: 1 branch
BranchTrueFalseTotal
if ($sel->name eq $name) 1 4 5
156 {
157 # return( $rule );
158 1 $found->push( $rule );
159 }
160 }
161 }
162 ## The user is calling this in a chain context, we make sure this is possible using the Module::Generic::Null class if needed
163 1 ▶ if( Wanted::want( 'OBJECT' ) )
Branch: 2 branches
BranchTrueFalseTotal
if (Wanted::want('OBJECT')) { } 0 1 1
elsif (Wanted::want('LIST')) { } 0 1 1
164 {
165 0 ▶ rreturn( $found->length > 0 ? $found->first : Module::Generic::Null->new );
Branch: 1 branch
BranchTrueFalseTotal
$found->length > 0 ? : 0 0 0
166 }
167 elsif( Wanted::want( 'LIST' ) )
168 {
169 0 rreturn( @$found );
170 }
171 else
172 {
173 1 return( $found->first );
174 }
175 }
176  
177 sub load_parser
178 5 ▶{
Subroutine load_parser: called CC=3 SCAR=11.2
Pod documented
179 5 my $self = shift( @_ );
180 5 my $parser_class = $self->parser;
181 5 ▶ $self->_load_class( "$parser_class" ) || return( $self->error( "Unable to load parser class \"$parser_class\": ", $self->error ) );
Branch: 1 branch
BranchTrueFalseTotal
$self->_load_class("$parser_class") or return $self->error(qq[Unable to load parser class "$parser_class": ], $self->error) 5 0 5
182 5 ▶ my $parser = $parser_class->scalar->new( $self ) || return( $self->error( "Unable to instantiate parser \"$parser_class\" object: ", $parser_class->scalar->error ) );
Condition50%1/2
$parser_class->scalar->new($self) || (return $self->error(qq[Unable to instantiate parser "$parser_class" object: ], $parser_class->scalar->error))
l!l
50
MC/DC0%0/1
$parser_class->scalar->new($self) || (return $self->error(qq[Unable to instantiate parser "$parser_class" object: ], $parser_class->scalar->error))
$parser_class->scalar->new($self)
Truth table50%1/2
A
A= $parser_class->scalar->new($self)
Aresult
11
00
183 5 $parser->debug( $self->debug );
184 5 return( $parser );
185 }
186  
187 sub new_at_rule
188 0 ▶{
Subroutine new_at_rule: not called CC=2 SCAR=17.9
Pod undocumented
189 0 my $self = shift( @_ );
190 0 my $o = CSS::Object::Rule::At->new( @_,
191 format => $self->format,
192 debug => $self->debug,
193 css => $self,
194 );
195 0 ▶ return( $self->error( "Cannot create a new at rule object: ", CSS::Object::Rule::At->error ) ) if( !defined( $o ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $o 0 0 0
196 0 return( $o );
197 }
198  
199 sub new_keyframes_rule
200 1 ▶{
Subroutine new_keyframes_rule: called CC=2 SCAR=7.0
Pod undocumented
201 1 my $self = shift( @_ );
202 1 my $o = CSS::Object::Rule::Keyframes->new( @_,
203 format => $self->format,
204 debug => $self->debug,
205 css => $self,
206 );
207 1 ▶ return( $self->error( "Cannot create a new keyframes rule object: ", CSS::Object::Rule::Keyframes->error ) ) if( !defined( $o ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $o 0 1 1
208 1 return( $o );
209 }
210  
211 sub new_comment
212 5 ▶{
Subroutine new_comment: called CC=2 SCAR=7.0
Pod documented
213 5 my $self = shift( @_ );
214 5 my $o = CSS::Object::Comment->new( @_, format => $self->format, debug => $self->debug );
215 5 ▶ return( $self->error( "Cannot create a new comment object: ", CSS::Object::Comment->error ) ) if( !defined( $o ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $o 0 5 5
216 5 return( $o );
217 }
218  
219 sub new_property
220 15 ▶{
Subroutine new_property: called CC=2 SCAR=7.0
Pod documented
221 15 my $self = shift( @_ );
222 15 my $o = CSS::Object::Property->new( @_, format => $self->format, debug => $self->debug );
223 15 ▶ return( $self->error( "Cannot create a new property object: ", CSS::Object::Property->error ) ) if( !defined( $o ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $o 0 15 15
224 15 return( $o );
225 }
226  
227 sub new_rule
228 26 ▶{
Subroutine new_rule: called CC=2 SCAR=7.0
Pod documented
229 26 my $self = shift( @_ );
230 26 my $o = CSS::Object::Rule->new( @_, format => $self->format, debug => $self->debug );
231 26 ▶ return( $self->error( "Cannot create a new rule object: ", CSS::Object::Rule->error ) ) if( !defined( $o ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $o 0 26 26
232 26 return( $o );
233 }
234  
235 sub new_selector
236 47 ▶{
Subroutine new_selector: called CC=2 SCAR=7.0
Pod documented
237 47 my $self = shift( @_ );
238 47 my $o = CSS::Object::Selector->new( @_, format => $self->format, debug => $self->debug );
239 47 ▶ return( $self->error( "Cannot create a new selector object: ", CSS::Object::Selector->error ) ) if( !defined( $o ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $o 0 47 47
240 47 return( $o );
241 }
242  
243 sub new_value
244 0 ▶{
Subroutine new_value: not called CC=2 SCAR=17.9
Pod documented
245 0 my $self = shift( @_ );
246 0 my $o = CSS::Object::Value->new( @_, format => $self->format, debug => $self->debug );
247 0 ▶ return( $self->error( "Cannot create a new value object: ", CSS::Object::Value->error ) ) if( !defined( $o ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $o 0 0 0
248 0 return( $o );
249 }
250  
251 sub parse_string
252 5 ▶{
Subroutine parse_string: called CC=3 SCAR=11.2
Pod documented
253 5 my $self = shift( @_ );
254 5 my $string = shift( @_ );
255  
256 # remove comments
257 # $string =~ s!/\*.*?\*\/!!g;
258 5 $string =~ s|<!--||g;
259 5 $string =~ s|-->||g;
260
261 5 ▶ my $parser = $self->load_parser || return( $self->pass_error );
Condition50%1/2
$self->load_parser || (return $self->pass_error)
l!l
50
MC/DC0%0/1
$self->load_parser || (return $self->pass_error)
$self->load_parser
Truth table50%1/2
A
A= $self->load_parser
Aresult
11
00
262 5 ▶ my $elems = $parser->parse_string( $string ) || return( $self->pass_error( $parser->error ) );
Condition50%1/2
$parser->parse_string($string) || (return $self->pass_error($parser->error))
l!l
50
MC/DC0%0/1
$parser->parse_string($string) || (return $self->pass_error($parser->error))
$parser->parse_string($string)
Truth table50%1/2
A
A= $parser->parse_string($string)
Aresult
11
00
263 5 return( $elems );
264 }
265  
266 6 ▶sub parser { return( shift->_set_get_scalar_as_object( 'parser', @_ ) ); }
Subroutine parser: called CC=1 SCAR=0.0
Pod documented
267  
268 2 ▶sub purge { return( shift->elements->reset ); }
Subroutine purge: called CC=1 SCAR=0.0
Pod documented
269  
270 sub read_file
271 5 ▶{
Subroutine read_file: called CC=8 SCAR=25.1
Pod documented
272 5 my $self = shift( @_ );
273 5 my $path = shift( @_ );
274  
275 5 ▶ if( ref( $path ) )
Branch: 2 branches
BranchTrueFalseTotal
if (ref $path) { } 0 5 5
elsif ($path) { } 5 0 5
276 {
277 0 ▶ if( ref( $path ) eq 'ARRAY' )
Branch: 1 branch
BranchTrueFalseTotal
if (ref $path eq "ARRAY") 0 0 0
278 {
279 0 $self->read_file( $_ ) for( @$path );
280 0 return( $self );
281 }
282 }
283 elsif( $path )
284 {
285 5 ▶ my $io = IO::File->new( "<$path" ) || return( $self->error( "Could not open file \"$path\": $!" ) );
Condition50%1/2
'IO::File'->new("<$path") || (return $self->error(qq[Could not open file "$path": $!]))
l!l
50
MC/DC0%0/1
'IO::File'->new("<$path") || (return $self->error(qq[Could not open file "$path": $!]))
'IO::File'->new("<$path")
Truth table50%1/2
A
A= 'IO::File'->new("<$path")
Aresult
11
00
286 5 $io->binmode( ':utf8' );
287 5 my $source = join( '', $io->getlines );
288 5 $io->close;
289 5 ▶ if( $source )
Branch: 1 branch
BranchTrueFalseTotal
if ($source) 5 0 5
290 {
291 5 ▶ my $elems = $self->parse_string( $source ) || return( $self->pass_error );
Condition50%1/2
$self->parse_string($source) || (return $self->pass_error)
l!l
50
MC/DC0%0/1
$self->parse_string($source) || (return $self->pass_error)
$self->parse_string($source)
Truth table50%1/2
A
A= $self->parse_string($source)
Aresult
11
00
292 # $self->rules->push( @$rules );
293 5 $self->elements->push( @$elems );
294 }
295 5 return( $self );
296 }
297 0 return( $self->error( "Only scalars and arrays accepted: $!" ) );
298 }
299  
300 sub read_string
301 0 ▶{
Subroutine read_string: not called CC=7 SCAR=40.3
Pod documented
302 0 my $self = shift( @_ );
303 0 my $data = shift( @_ );
304  
305 0 ▶ if( ref( $data ) )
Branch: 2 branches
BranchTrueFalseTotal
if (ref $data) { } 0 0 0
elsif (length $data) { } 0 0 0
306 {
307 0 ▶ if( ref( $data ) eq 'ARRAY' )
Branch: 1 branch
BranchTrueFalseTotal
if (ref $data eq "ARRAY") 0 0 0
308 {
309 0 for( @$data )
310 {
311 0 ▶ $self->read_string( $_ ) || return( $self->pass_error );
Branch: 1 branch
BranchTrueFalseTotal
$self->read_string($_) or return $self->pass_error 0 0 0
312 }
313 0 return( $self );
314 }
315 }
316 elsif( length( $data ) )
317 {
318 0 ▶ my $elems = $self->parse_string( $data ) || return( $self->pass_error );
Condition0%0/2
$self->parse_string($data) || (return $self->pass_error)
l!l
00
MC/DC0%0/1
$self->parse_string($data) || (return $self->pass_error)
$self->parse_string($data)
Truth table0%0/2
A
A= $self->parse_string($data)
Aresult
11
00
319 ## $self->rules->push( @$rules );
320 0 $self->elements->push( @$elems );
321 }
322 0 return( $self );
323 }
324  
325 sub remove_rule
326 0 ▶{
Subroutine remove_rule: not called CC=3 SCAR=24.8
Pod undocumented
327 0 my $self = shift( @_ );
328 0 my $rule = shift( @_ );
329 0 ▶ return( $self->error( "No rule object was provided to remove." ) ) if( !defined( $rule ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $rule 0 0 0
330 0 ▶ return( $self->error( "Object provided is not a CSS::Object::Rule object." ) ) if( !$self->_is_a( $rule, 'CSS::Object::Rule' ) );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_is_a($rule, "CSS::Object::Rule") 0 0 0
331 0 $self->elements->remove( $rule );
332 0 return( $self );
333 }
334  
335 # sub rules { return( shift->_set_get_array_as_object( 'rules', @_ ) ); }
336 27 ▶sub rules { return( $_[0]->elements->map(sub{ $_[0]->_is_a( $_, 'CSS::Object::Rule' ) ? $_ : () }) ); }
Subroutine __ANON__: called CC=2 SCAR=7.2
Subroutine rules: called CC=1 SCAR=0.2
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->_is_a($_, 'CSS::Object::Rule') ? : 27 0 27
337  
338 6 1;
339 # NOTE POD
340 __END__
« Object/Value.pm ↑ Summary Object/Element.pm »