| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# Graph::Writer - perl base class for Graph file format writers |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
package Graph::Writer; |
|
5
|
|
|
|
|
|
|
$Graph::Writer::VERSION = '2.09'; |
|
6
|
3
|
|
|
3
|
|
1023
|
use 5.006; |
|
|
3
|
|
|
|
|
6
|
|
|
7
|
3
|
|
|
3
|
|
10
|
use strict; |
|
|
3
|
|
|
|
|
2
|
|
|
|
3
|
|
|
|
|
47
|
|
|
8
|
3
|
|
|
3
|
|
7
|
use warnings; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
58
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
3
|
|
|
3
|
|
1217
|
use IO::File; |
|
|
3
|
|
|
|
|
18668
|
|
|
|
3
|
|
|
|
|
665
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#======================================================================= |
|
13
|
|
|
|
|
|
|
# |
|
14
|
|
|
|
|
|
|
# new () - constructor |
|
15
|
|
|
|
|
|
|
# |
|
16
|
|
|
|
|
|
|
# Create an instance of a Graph writer. This will not be invoked |
|
17
|
|
|
|
|
|
|
# directly on this class, but will be inherited by writers for |
|
18
|
|
|
|
|
|
|
# specific formats. |
|
19
|
|
|
|
|
|
|
# |
|
20
|
|
|
|
|
|
|
#======================================================================= |
|
21
|
|
|
|
|
|
|
sub new |
|
22
|
|
|
|
|
|
|
{ |
|
23
|
10
|
|
|
10
|
1
|
5409
|
my $class = shift; |
|
24
|
|
|
|
|
|
|
|
|
25
|
10
|
100
|
|
|
|
28
|
die "don't create an instance of $class!\n" if $class eq __PACKAGE__; |
|
26
|
|
|
|
|
|
|
|
|
27
|
9
|
|
|
|
|
20
|
my $self = bless {}, $class; |
|
28
|
|
|
|
|
|
|
|
|
29
|
9
|
|
|
|
|
31
|
$self->_init(@_); |
|
30
|
|
|
|
|
|
|
|
|
31
|
9
|
|
|
|
|
14
|
return $self; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
#======================================================================= |
|
35
|
|
|
|
|
|
|
# |
|
36
|
|
|
|
|
|
|
# _init() - initialise instance |
|
37
|
|
|
|
|
|
|
# |
|
38
|
|
|
|
|
|
|
# This is for any instance-specific initialisation. The idea is that |
|
39
|
|
|
|
|
|
|
# a sub-class will define an _init() method if it needs one. |
|
40
|
|
|
|
|
|
|
# For future compatibility the class-specific method should invoke |
|
41
|
|
|
|
|
|
|
# this. |
|
42
|
|
|
|
|
|
|
# |
|
43
|
|
|
|
|
|
|
#======================================================================= |
|
44
|
|
|
|
|
|
|
sub _init |
|
45
|
|
|
|
9
|
|
|
{ |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
#======================================================================= |
|
50
|
|
|
|
|
|
|
# |
|
51
|
|
|
|
|
|
|
# write_graph() - write the specified graph to the specified file (handle) |
|
52
|
|
|
|
|
|
|
# |
|
53
|
|
|
|
|
|
|
# This is the public method that will be invoked to write a graph. |
|
54
|
|
|
|
|
|
|
# The file can be specified either as a filename, or a filehandle. |
|
55
|
|
|
|
|
|
|
# |
|
56
|
|
|
|
|
|
|
#======================================================================= |
|
57
|
|
|
|
|
|
|
sub write_graph |
|
58
|
|
|
|
|
|
|
{ |
|
59
|
9
|
|
|
9
|
1
|
56
|
my $self = shift; |
|
60
|
9
|
|
|
|
|
7
|
my $graph = shift; |
|
61
|
9
|
|
|
|
|
8
|
my $filename = shift; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
|
64
|
9
|
100
|
|
|
|
16
|
if (ref $filename) |
|
65
|
|
|
|
|
|
|
{ |
|
66
|
4
|
|
|
|
|
9
|
$self->_write_graph($graph, $filename); |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
else |
|
69
|
|
|
|
|
|
|
{ |
|
70
|
5
|
|
|
|
|
25
|
my $FILE = IO::File->new("> $filename"); |
|
71
|
5
|
50
|
|
|
|
417
|
if (not defined $FILE) |
|
72
|
|
|
|
|
|
|
{ |
|
73
|
0
|
|
|
|
|
0
|
warn "couldn't write to $filename: $!\n"; |
|
74
|
0
|
|
|
|
|
0
|
return 0; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
5
|
|
|
|
|
21
|
$self->_write_graph($graph, $FILE); |
|
77
|
5
|
|
|
|
|
17
|
$FILE->close(); |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
9
|
|
|
|
|
207
|
return 1; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
__END__ |