File: File.pm

package info (click to toggle)
libsvg-graph-perl 0.02-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 616 kB
  • sloc: perl: 2,793; makefile: 2
file content (115 lines) | stat: -rw-r--r-- 1,350 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package SVG::Graph::File;

use strict;

=head2 new

 Title   : new
 Usage   :
 Function:
 Example :
 Returns : 
 Args    :


=cut

sub new
{
   my ($class,%args) = @_;
   my $self = bless {}, $class;
   $self->init(%args);
   return($self);
}

=head2 init

 Title   : init
 Usage   :
 Function:
 Example :
 Returns : 
 Args    :


=cut

sub init
{
  my ($self, %args) = @_;
  foreach my $arg (keys %args){
	my $meth = $arg;
	if($self->can($meth)){
	  $self->$meth($args{$arg});
	} else {
	  $self->_style($arg => $args{$arg});
	}
  }
}


=head2 read_data

 Title   : read_data
 Usage   :
 Function:
 Example :
 Returns : 
 Args    :


=cut

sub read_data{
   my ($self,@args) = @_;

   die "method undefined by ".__PACKAGE__;
}

=head2 write_data

 Title   : write_data
 Usage   :
 Function:
 Example :
 Returns : 
 Args    :


=cut

sub write_data{
   my ($self,@args) = @_;

   die "method undefined by ".__PACKAGE__;
}


=head2 _style

 Title   : _style
 Usage   : $obj->_style($newval)
 Function: 
 Example : 
 Returns : 
 Args    : 


=cut

sub _style
{
    my $self = shift;
	my($key,$val) = @_;

	if(defined($key) and not defined($val)){
	  return $self->{'_style'}{$key};
	} elsif(defined($key) and defined($val)){
	  $self->{'_style'}{$key} = $val;
	  return $val;
	} else {
	  return $self->{'_style'} ? %{$self->{'_style'}} : ();
	}
}

1;