line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package UML::Sequence::PerlSeq; |
2
|
1
|
|
|
1
|
|
22911
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
70
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
UML::Sequence::PerlSeq - for use with genericseq.pl script, works on Perl programs |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
genericseq.pl UML::Sequence::PerlSeq methods_file perl_program [args...] > sequence.xml |
12
|
|
|
|
|
|
|
seq2svg.pl sequence.xml > sequence.svg |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
OR |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
genericseq.pl UML::Sequence::PerlSeq methods_file program [args...] | seq2svg.pl > sequence.svg |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
This file must be used by a script. On demand it will form an outline by |
21
|
|
|
|
|
|
|
running the supplied program with -d:UML::CallSeq which is included in |
22
|
|
|
|
|
|
|
the UML::Sequence distribution. This has been developed on |
23
|
|
|
|
|
|
|
Cygwin under Windows 2000 and tested on Red Hat Linux 7.1. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
The methods file should list methods you WANT to hear about. If it isn't |
26
|
|
|
|
|
|
|
in the list, it will not appear in the picture. The format of the file |
27
|
|
|
|
|
|
|
is like this: |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
DiePair::new |
30
|
|
|
|
|
|
|
Die::new |
31
|
|
|
|
|
|
|
DiePair::roll |
32
|
|
|
|
|
|
|
Die::roll |
33
|
|
|
|
|
|
|
DiePair::total |
34
|
|
|
|
|
|
|
DiePair::doubles |
35
|
|
|
|
|
|
|
DiePair::to_string |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Order is not important. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
42
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
10674
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
our $VERSION = "0.02"; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my $methods_file; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 grab_outline_text |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Call this method first. Call it through the class |
51
|
|
|
|
|
|
|
(UML::Sequence::PerlSeq->grab_outline_text) |
52
|
|
|
|
|
|
|
passing it the methods_file, the program to run, and any args for that program. |
53
|
|
|
|
|
|
|
Returns an outline (suitable for printing or passing on to SeqOutline). |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
56
|
|
|
|
|
|
|
sub grab_outline_text { |
57
|
1
|
|
|
1
|
0
|
12
|
shift; # discard class name |
58
|
1
|
|
|
|
|
3
|
$methods_file = shift; |
59
|
1
|
|
|
|
|
5
|
_profile(@_); |
60
|
1
|
|
|
|
|
40
|
return _read_tmon(); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub _profile { |
64
|
1
|
|
|
1
|
|
17784
|
`perl -d:CallSeq @_`; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub _read_tmon { |
68
|
1
|
|
|
1
|
|
8
|
my @retval; |
69
|
1
|
50
|
|
|
|
82
|
open TMON, "tmon.out" or die "Couldn't read tmon.out from Devel::CallSeq\n"; |
70
|
1
|
|
|
|
|
35
|
while () { |
71
|
9
|
|
|
|
|
17
|
chomp; |
72
|
9
|
|
|
|
|
49
|
push @retval, $_; |
73
|
|
|
|
|
|
|
} |
74
|
1
|
|
|
|
|
86
|
unlink "tmon.out"; |
75
|
1
|
|
|
|
|
24
|
return \@retval; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 grab_methods |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Call this only after you have called grab_outline. Call it through the class: |
81
|
|
|
|
|
|
|
UML::Sequence::PerlSeq->grab_methods. Arguments are ignored. |
82
|
|
|
|
|
|
|
Returns a reference to an array listing the methods of interest. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub grab_methods { |
87
|
1
|
|
|
1
|
0
|
1482
|
shift; # discard class |
88
|
|
|
|
|
|
|
|
89
|
1
|
50
|
|
|
|
61
|
open METHODS, "$methods_file" or die "Couldn't open $methods_file\n"; |
90
|
1
|
|
|
|
|
43
|
chomp(my @methods = ); |
91
|
1
|
|
|
|
|
12
|
close METHODS; |
92
|
|
|
|
|
|
|
|
93
|
1
|
|
|
|
|
7
|
return \@methods; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 parse_signature |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Pass a reference to this method to the UML::Sequence constructor. It must |
99
|
|
|
|
|
|
|
accept a method signature and return the class name (in scalar context) or |
100
|
|
|
|
|
|
|
the class and method names in that order (in list context). |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub parse_signature { |
105
|
0
|
|
|
0
|
0
|
|
my $signature = shift; |
106
|
0
|
|
|
|
|
|
my $class = $signature; |
107
|
0
|
|
|
|
|
|
$class =~ s/::([^:]+)$//; |
108
|
0
|
|
|
|
|
|
my $method = $1; |
109
|
|
|
|
|
|
|
|
110
|
0
|
0
|
|
|
|
|
return wantarray ? ($class, $method) : $class; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
1; |