Pavel Shaydo > Simulation-DiscreteEvent-0.09 > Simulation::DiscreteEvent::Recorder

Download:
Simulation-DiscreteEvent-0.09.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.09   Source  

NAME ^

Simulation::DiscreteEvent::Recorder - Moose role for recording all events for server

SYNOPSIS ^

Add Simulation::DiscreteEvent::Recorder role to your server:

    package MyServer;
    use Moose;
    BEGIN { extends 'Simulation::DiscreteEvent::Server'; }
    with 'Simulation::DiscreteEvent::Recorder';
    sub handler1 : Event(start) {
        # handle start event here
    }
    sub handler2 : Event(stop) {
        # handle stop event here
    }

Then after running simulation you can get information about moments of the events, intervals between events, etc:

    my @events = $server->get_all_events;
    my $started = $server->get_number_of('start');
    my @started_at = $server->get_moments_of('start');
    my @stop_intvl = $server->intervals_between('stop');

DESCRIPTION ^

This role allows you to record information about every event during simulation.

METHODS ^

The following methods are added to the class that uses that role

$self->get_all_events

Returns list of all events handled by this server. Every item in the list is refference to array with two elements: time the event has occured, and name of the event.

$self->get_number_of([$event])

Returns how many times $event has occured. If $event is not specified returns total number of the events.

$self->get_moments_of([$event])

Returns list of moments at which $event has occured. If $event is not specified returns moments of all events.

$self->intervals_between([$event])

Returns intervals between subsequent moments when $event has occured. As for previous function, if $event is missed uses all events.

AUTHOR ^

Pavel Shaydo, <zwon at cpan.org>

SUPPORT ^

Please see documentation for Simulation::DiscreteEvent

LICENSE AND COPYRIGHT ^

Copyright 2010 Pavel Shaydo.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

syntax highlighting: