Message::Passing:Role::Script - Handy role for building messaging scripts.
# my_message_passer.pl package My::Message::Passer; use Moose; use Message::Passing::DSL; with 'Message::Passing::Role::Script'; with 'MooseX::Getopt'; has foo => ( is => 'ro', isa => 'Bool', ); sub build_chain { my $self = shift; log_chain { input example => ( output_to => 'test_out', .... ); output test_out => ( foo => $self->foo, ... ); }; } __PACKAGE__->start unless caller; 1;
This role can be used to make simple message passing scripts.
The user implements a MooseX::Getopt type script class, with a build_chain method, that builds one or more Message::Passing chains and returns them.
build_chain
__PACKAGE__->start unless caller;
is then used before the end of the script.
This means that when the code is run as a script, it'll parse the command line options, and start a message passing server..
Return a chain of message processors, or an array reference with multiple chains of message processors.
Called as a class method, it will build the current class as a command line script (parsing ARGV), setup the daemonization options, call the ->build_chain method supplied by the user to build the chains needed for this application.
Then enters the event loop and never returns.
Tries to change uid if the --user option has been supplied
Tires to daemonize if the --daemonize option has been supplied
Tries to set the process' IO priority if the --io_priority option has been supplied.
Valid values for the IO priority are:
Tomas (t0m) Doran <bobtfish@bobtfish.net>
This module exists due to the wonderful people at Suretec Systems Ltd. <http://www.suretecsystems.com/> who sponsored it's development for its VoIP division called SureVoIP <http://www.surevoip.co.uk/> for use with the SureVoIP API - <http://www.surevoip.co.uk/support/wiki/api_documentation>
Copyright Suretec Systems Ltd. 2012.
Logstash (upon which many ideas for this project is based, but which we do not reuse any code from) is copyright 2010 Jorden Sissel.
GNU Affero General Public License, Version 3
If you feel this is too restrictive to be able to use this software, please talk to us as we'd be willing to consider re-licensing under less restrictive terms.
To install Message::Passing, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Message::Passing
CPAN shell
perl -MCPAN -e shell install Message::Passing
For more information on module installation, please visit the detailed CPAN module installation guide.