File Coverage

blib/lib/UML/Sequence/JavaSeq.pm
Criterion Covered Total %
statement 9 19 47.3
branch 0 2 0.0
condition n/a
subroutine 3 4 75.0
pod 0 1 0.0
total 12 26 46.1


line stmt bran cond sub pod time code
1             package UML::Sequence::JavaSeq;
2 1     1   31827 use UML::Sequence::SimpleSeq;
  1         3  
  1         48  
3              
4             @ISA = ('UML::Sequence::SimpleSeq');
5             $VERSION = '0.02';
6              
7 1     1   7 use strict;
  1         2  
  1         29  
8 1     1   5 use warnings;
  1         1  
  1         156  
9              
10             =head1 NAME
11              
12             UML::Sequence::JavaSeq - for use with genericseq.pl script, works on compiled Java programs
13              
14             =head1 SYNOPSIS
15              
16             genericseq.pl UML::Sequence::JavaSeq Hello.methods Hello > Hello.xml
17             seq2svg.pl Hello.xml > Hello.svg
18              
19             OR
20              
21             genericseq.pl UML::Sequence::JavaSeq Hello.methods Hello | seq2svg.pl > Hello.svg
22              
23             =head1 DESCRIPTION
24              
25             This file depends on L and a Java tool called
26             Seq.java. The later produces an outline of the calls to methods named
27             in Hello.methods. The former provides methods L needs to produce
28             an xml sequence. Look in the provided Hello.methods to see what options
29             you have for controlling output.
30              
31             For this class to work, you must have Seq.class (and its friends) and
32             tools.jar (the one containing the the jpda) in your class path. Your
33             jpda must be happy. (The jpda is the Java Platform Debugger Architecture.
34             It ships with java 1.3.)
35              
36             =head1 grab_outline_text
37              
38             Call this method through the class name with the method file, the class
39             you want to sequence, and any arguments that class's main method needs.
40             Returns an outline you can pass to UML::Sequence::SimpleSeq->grab_methods
41             and to the UML::Sequence constructor.
42              
43             =cut
44              
45             sub grab_outline_text {
46 0     0 0   shift; # discard class name
47 0           my @retval;
48 0           my $method_file = shift;
49              
50 0           `java Seq $method_file SEQ.TMP @_ > /dev/null`;
51              
52 0 0         open SEQ, "SEQ.TMP" or die "Couldn't run java Seq: $!\n";
53 0           while () {
54 0           push @retval, $_;
55             }
56 0           close SEQ;
57              
58 0           unlink "SEQ.TMP";
59 0           return \@retval;
60             }
61              
62             1;