Graph/File.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 54 CC 5 SCAR 23.0
CC
5
Cov
0%
_style
20.0
init
6.0
new
2.0
CRAP 10.0
1 package SVG::Graph::File;
2  
3 use strict;
4  
5 =head2 new
6  
7 Title : new
8 Usage :
9 Function:
10 Example :
11 Returns :
12 Args :
13  
14  
15 =cut
16  
17 sub new
18 {
19 my ($class,%args) = @_;
20 my $self = bless {}, $class;
21 $self->init(%args);
22 return($self);
23 }
24  
25 =head2 init
26  
27 Title : init
28 Usage :
29 Function:
30 Example :
31 Returns :
32 Args :
33  
34  
35 =cut
36  
37 sub init
38 {
39 my ($self, %args) = @_;
40 foreach my $arg (keys %args){
41 my $meth = $arg;
42 if($self->can($meth)){
43 $self->$meth($args{$arg});
44 } else {
45 $self->_style($arg => $args{$arg});
46 }
47 }
48 }
49  
50  
51 =head2 read_data
52  
53 Title : read_data
54 Usage :
55 Function:
56 Example :
57 Returns :
58 Args :
59  
60  
61 =cut
62  
63 sub read_data{
64 my ($self,@args) = @_;
65  
66 die "method undefined by ".__PACKAGE__;
67 }
68  
69 =head2 write_data
70  
71 Title : write_data
72 Usage :
73 Function:
74 Example :
75 Returns :
76 Args :
77  
78  
79 =cut
80  
81 sub write_data{
82 my ($self,@args) = @_;
83  
84 die "method undefined by ".__PACKAGE__;
85 }
86  
87  
88 =head2 _style
89  
90 Title : _style
91 Usage : $obj->_style($newval)
92 Function:
93 Example :
94 Returns :
95 Args :
96  
97  
98 =cut
99  
100 sub _style
101 {
102 my $self = shift;
103 my($key,$val) = @_;
104  
105 if(defined($key) and not defined($val)){
106 return $self->{'_style'}{$key};
107 } elsif(defined($key) and defined($val)){
108 $self->{'_style'}{$key} = $val;
109 return $val;
110 } else {
111 return $self->{'_style'} ? %{$self->{'_style'}} : ();
112 }
113 }
114  
115 1;