DOM2/Element/Text.pm untested

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