NAME

Simulation::DiscreteEvent::Server - Moose role for implementing servers

SYNOPSIS

package MyServer;
use Moose;
with 'Simulation::DiscreteEvent::Server';
sub _dispatch { { event => \&handler }->{$_[1]} };
sub handler {
    # handle event here
}
no Moose;
__PACKAGE__->meta->make_immutable;

Description

This is a Moose role that used to implement servers for Simulation::DiscreteEvent models.

SUBROUTINES/METHODS

_dispatch($event)

Subclasses are required to implement _dispatch. This method takes an event name as argument and should return reference to event handler, or undef. This is likely to be replaced in future versions with more convenient mechanism.

name([$name])

Allows you to get/set the name of the server

handle($event, @args)

Invokes handler for $event and passes @args as arguments.

AUTHOR

Pavel Shaydo, <zwon at cpan.org>

BUGS

Please report any bugs or feature requests to bug-simulation-discreteevent at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Simulation-DiscreteEvent. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Simulation::DiscreteEvent

You can also look for information at:

ACKNOWLEDGEMENTS

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.