Pcore::Core::Event - Pcore event broker
P->bind_events( [ 'test1', 'test2.*.log', 'test3.#' ], # bindings sub ( $ev ) { # callback say dump $ev->{key}; say dump $ev->{data}; return; }, ); P->bind_events( 'log.test.*', 'stderr:' ); # pipe P->bind_events( 'log.test.*', [ 'stderr:', tmpl => "<: \$key :>$LF<: \$text :>" ] ); # pipe with params P->bind_events( 'log.test.*', [ 'file:123.log', tmpl => "<: \$key :>$LF<: \$text :>" ] ); # pipe with params P->fire_event( 'test.1234.aaa', $data );
$key - event key, special symbols can be used:
* (star) can substitute for exactly one word;
# (hash) can substitute for zero or more words;
where word is /[^.]/
To install Pcore, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Pcore
CPAN shell
perl -MCPAN -e shell install Pcore
For more information on module installation, please visit the detailed CPAN module installation guide.