blib/lib/UML/Sequence/PerlOOSeq.pm

filter: Statementstmt 86.1% 31 / 36 Branchbran 50.0% 4 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod 0.0% 0 / 3 totaltotal 76.7% 43 / 56 CC 5 SCAR 8.7
CC
5
Cov
80%
parse_signature
6.0
_read_tmon
3.0
grab_methods
2.0
CRAP 2.4
« blib/lib/UML/Sequence/Activation.pm ↑ Summary blib/lib/UML/Sequence/PerlSeq.pm »
1 package UML::Sequence::PerlOOSeq;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 =head1 NAME
6  
7 UML::Sequence::PerlOOSeq - helper for genericseq.pl showing object instances
8  
9 =head1 SYNOPSIS
10  
11 genericseq.pl UML::Sequence::PerlOOSeq methods_file perl_program [args...] > sequence.xml
12 seq2svg.pl sequence.xml > sequence.svg
13  
14 OR
15  
16 genericseq.pl UML::Sequence::PerlOOSeq methods_file program [args...] | seq2svg.pl > sequence.svg
17  
18 =cut
19  
20 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 1 our $VERSION = "0.02";
24  
25 1 my $methods_file;
26  
27 =head1 grab_outline_text
28  
29 Call this method first. Call it through the class
30 (UML::Sequence::PerlOOSeq->grab_outline_text)
31 passing it the methods_file, the program to run, and any args for that program.
32 Returns an outline (suitable for printing or passing on to UML::Sequence).
33  
34 =cut
35 1 ▶sub grab_outline_text {
Subroutine grab_outline_text: called CC=1 SCAR=0.0
Pod undocumented
36 1 shift; # discard class name
37 1 $methods_file = shift;
38 1 _profile(@_);
39 1 return _read_tmon();
40 }
41  
42 1 ▶sub _profile {
Subroutine _profile: called CC=1 SCAR=0.0
43 1 `perl -d:OOCallSeq @_`;
44 }
45  
46 1 ▶sub _read_tmon {
Subroutine _read_tmon: called CC=3 SCAR=11.0
47 1 my @retval;
48 1 ▶ open TMON, "tmon.out" or die "Couldn't run under Devel::OOCallSeq $!\n";
Branch: 1 branch
BranchTrueFalseTotal
open TMON, "tmon.out" or die "Couldn't run under Devel::OOCallSeq $!\n" 1 0 1
49 1 ▶ while (<TMON>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline TMON)) 10 1 11
50 10 chomp;
51 10 push @retval, $_;
52 }
53 1 return \@retval;
54 }
55  
56 =head1 grab_methods
57  
58 Call this only after you have called grab_outline. Call it through the class:
59 PerlSeq->grab_methods. Arguments are ignored.
60 Returns a reference to an array listing the methods of interest.
61  
62 =cut
63  
64 1 ▶sub grab_methods {
Subroutine grab_methods: called CC=2 SCAR=7.0
Pod undocumented
65 1 shift; # discard class
66  
67 1 ▶ open METHODS, "$methods_file" or die "Couldn't open $methods_file\n";
Branch: 1 branch
BranchTrueFalseTotal
open METHODS, "$methods_file" or die "Couldn't open $methods_file\n" 1 0 1
68 1 chomp(my @methods = <METHODS>);
69 1 close METHODS;
70  
71 1 return \@methods;
72 }
73  
74 =head1 parse_signature
75  
76 Pass a reference to this method to the SeqOutline constructor. It must
77 accept a method signature and return the class name (in scalar context) or
78 the class and method names in that order (in list context).
79  
80 =cut
81  
82 0 ▶sub parse_signature {
Subroutine parse_signature: not called CC=2 SCAR=17.9
Pod undocumented
83 0 my $signature = shift;
84 0 my $class = $signature;
85 0 $class =~ s/::([^:]+)$//;
86 0 my $method = $1;
87  
88 0 ▶ return wantarray ? ($class, $method) : $class;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
89 }
90  
91 1 1;
« blib/lib/UML/Sequence/Activation.pm ↑ Summary blib/lib/UML/Sequence/PerlSeq.pm »