Message::Router - Fast, simple message routing
use Message::Router qw(mroute mroute_config); sub main::handler1 { my %args = @_; #gets: # $args{message} # $args{route} # $args{routes} # $args{forward} print "$args{message}->{this}\n"; #from the transform print "$args{forward}->{x}\n"; #from the specific forward } mroute_config({ routes => [ { match => { a => 'b', }, forwards => [ { handler => 'main::handler1', x => 'y', }, ], transform => { this => 'that', }, } ], }); mroute({a => 'b'}); #prints 'that', and then 'y', per the handler1 sub
This library allows fast, flexible and general message routing.
The config used by all mroute calls
Pass $message through the config; this will emit zero or more callbacks.
A config validator. Short-circuiting More flexible match and transform configuration forms
None known.
Copyright (c) 2012, 2013 Dana M. Diederich. All Rights Reserved.
Dana M. Diederich <diederich@gmail.com>
To install Message::Router, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Message::Router
CPAN shell
perl -MCPAN -e shell install Message::Router
For more information on module installation, please visit the detailed CPAN module installation guide.