Chart::Sequence - A sequence class
use Chart::Sequence; my $s = Chart::Sequence->new( Nodes => [qw( A B C )], Messages => [ [ A => B => "Message 1" ], [ B => A => "Ack 1" ], [ B => C => "Message 2" ], ], ); # or # my $s = Chart::Sequence->new( SeqMLInput => "foo.seqml", ); my $r = Chart::Sequence::Imager->new; my $png => $r->render( $s => "png" ); $r->render_to_file( $s => "foo.png" );
ALPHA CODE ALERT: This is alpha code and the API will be changing. For instance, I need to generalize "messages" in to "events". Feedback wanted.
A sequence chart portrays a sequence of events occuring among a set of objects or, as we refer to them, nodes.
So far, this class only supports portrayal of messages between nodes (and then not even from a node to itself). More events are planned.
So, a Chart::Sequence has a list of nodes and a list of messages. Nodes will be instantiated automatically from the messages destinations (an option to disable this will be forthcoming).
A sequence may created and populated in one or more of 3 ways:
Messages and, optionally, nodes may be passed in to new()
Messages and, optionally, nodes may be added or removed en masse using the appropriate methods.
"SeqML" files may be parsed using Chart::Sequence::SAXBuilder. See the test scripts for examples
A small example (example_sequence_chart.png) is included in the tarball.
Once built, charts may be layed out using a pluggable layout and rendering system for which only one pixel-graphics oriented layout (Chart::Sequence::Layout) and one renderer (Chart::Sequence::Renderer::Imager) exist.
More docs forthcoming; feel free to ask.
my $s = Chart::Sequence->new;
Sets/gets the name of this sequence
A node is something that sends or receives a message.
$s->nodes( $node1, $node2, ... ); my @nodes = $s->nodes;
Sets / gets the list of nodes. If any messages refer to non-existent nodes, the missing nodes are created.
Sets/gets an ARRAY reference to an array containing nodes.
Appends one or more nodes to the end of the current list.
Gets a node by name.
$s->messages( $msg1, $msg2, ... ); my @messages = $s->messages;
Returns or sets the list of messages.
Returns or sets the list of messages as an ARRAY reference.
Adds messages to the end of the sequence.
my $s = Chart::Sequence->read_seqml( "some.seqml" ); $s = Chart::Sequence->read_seqml( "more.seqml" );
Reads XML from a filehandle, a SCALAR reference, or a named file.
When called as a class method, returns a new Chart::Sequence object. When called as an instance method add additional events to the instance.
Requirese the optional prerequisite XML::SAX.
Requires XML::SAX::PurePurl for now. The latest XML::LibXML::SAX seems to not notice <foo xmlns"http://bar/..."> declarations.
Copyright 2002, R. Barrie Slaymaker, Jr., All Rights Reserved
You may use this module under the terms of the BSD, Artistic, oir GPL licenses, any version.
Barrie Slaymaker <firstname.lastname@example.org>