Simulation::DiscreteEvent::Generator - Event generator
my $gen = $model->add( 'Simulation::DiscreteEvent::Generator', start_at => 2, interval => sub { 7 * rand }, message => sub { sprintf "Now: %d", shift->model->time }, event_name => 'ping', limit => 1000, dest => $server, );
This class is descendant of Simulation::DiscreteEvent::Server, its purpose is to add event generators to model.
Here's the list of object attributes:
This attribute may be passed only at the time of object construction. It specifies the time of the first event. If you didn't specified this parameter you should schedule the "next" event for the created object, or it won't generate any events.
This attribute is a reference to subroutine that returns time till the next event should happen. Usually this subroutine generates some random values. Reference to the object is passed to subroutine as the only argument. This attribute is required.
This optional attribute contains reference to a subroutine that generates messages which should be passed to destination event handler along with events.
Attribute contains name of the generated events.
Number of events that should be generated. If attribute is not defined, generator will never stop while simulation is running.
Server that should receive and handle generated events.
Pavel Shaydo, <zwon at cpan.org>
<zwon at cpan.org>
Please see documentation for Simulation::DiscreteEvent
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.
To install Simulation::DiscreteEvent, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Simulation::DiscreteEvent
CPAN shell
perl -MCPAN -e shell install Simulation::DiscreteEvent
For more information on module installation, please visit the detailed CPAN module installation guide.