DOM2/Element/Rect.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 7 totaltotal 0.0% 0 / 60 CC 3 SCAR 11.7
CC
3
Cov
0%
_attribute_handle
6.0
attr
6.0
new
2.0
CRAP 3.2
1 package SVG::DOM2::Element::Rect;
2  
3 use base "SVG::DOM2::Element::Shape";
4 use base "SVG::DOM2::Element::Shape::Fill";
5 use base "SVG::DOM2::Element::Shape::Stroke";
6  
7 use SVG::DOM2::Attribute::Metric;
8  
9 sub new
10 {
11 my ($proto, %args) = @_;
12 return $proto->SUPER::new('rect', %args);
13 }
14  
15 sub _attribute_handle
16 {
17 my ($self, $name, %opts) = @_;
18 return SVG::DOM2::Attribute::Metric->new(%opts)
19 if $name eq 'x' or $name eq 'width'
20 or $name eq 'y' or $name eq 'height';
21 return $self->SUPER::_attribute_handle($name, %opts);
22 }
23  
24 sub attr
25 {
26 my ($self, $name, $set) = @_;
27 $self->setAttribute($name, $set) if defined($set);
28 return $self->getAttribute($name);
29 }
30  
31 sub width { shift->attr('width', @_); }
32 sub height { shift->attr('height', @_); }
33 sub x { shift->attr('x', @_); }
34 sub y { shift->attr('y', @_); }
35  
36 return 1;