NAME

Net::Stomp::MooseHelpers::ReadTrace - class to read the output of Net::Stomp::MooseHelpers::TraceStomp

VERSION

version 1.0

SYNOPSIS

my $reader = Net::Stomp::MooseHelpers::ReadTrace->new({
   trace_basedir => '/tmp/mq',
});

my @frames = $reader->sorted_frames('/queue/somewhere');

DESCRIPTION

Net::Stomp::MooseHelpers::TraceStomp and Net::Stomp::MooseHelpers::TraceOnly write STOMP frames to disk. This class helps you read them back.

ATTRIBUTES

trace_basedir

The directory from which frames will be read. Accepts strings and Path::Class::Dir objects.

METHODS

read_frame_from_filename

my $stomp_frame = $reader->read_frame_from_filename('/a/path');

Given a filename (unrelated to "trace_basedir"), returns a Net::Stomp::Frame object parsed from it, using "read_frame_from_fh".

read_frame_from_fh

my $stomp_frame = $reader->read_frame_from_fh($fh);

Given a filehandle (binmode it first!), returns a Net::Stomp::Frame object parsed from it. If the filehandle contains more than one frame, reads the first one and leaves the read position just after it.

If the file was not a dumped STOMP frame, this function may still return a frame, but the contents are probably going to be useless.

sorted_filenames

my @names = $reader->sorted_filenames();
my @names = $reader->sorted_filenames($destination);

Given a destination (/queue/something or similar), returns all frame dump filenames found under the corresponding dump directory under "trace_basedir", sorted by filename (that is, by timestamp).

If you don't specify a destination, all filenames from all destinations will be returned.

sorted_frames

my @frames = $reader->sorted_frames();
my @frames = $reader->sorted_frames($destination);

Same as "sorted_filenames", but returns the parsed frames instead of the filenames.

AUTHOR

Gianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Net-a-porter.com.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.