POE::Component::SubWrapper

POE::Component::SubWrapper is an event based wrapper for subs.
Download

POE::Component::SubWrapper Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Michael Stevens
  • Publisher web site:
  • http://search.cpan.org/~sungo/POE-Component-SubWrapper-0.08/lib/POE/Component/SubWrapper.pm

POE::Component::SubWrapper Tags


POE::Component::SubWrapper Description

POE::Component::SubWrapper is an event based wrapper for subs. POE::Component::SubWrapper is an event based wrapper for subs.SYNOPSIS use POE::Component::SubWrapper; POE::Component::SubWrapper->spawn('main'); $kernel->post('main', 'my_sub', , 'callback_state');This is a module which provides an event based wrapper for subroutines.SubWrapper components are not normal objects, but are instead 'spawned' as separate sessions. This is done with with PoCo::SubWrapper's 'spawn' method, which takes one required and one optional argument. The first argument is the package name to wrap. This is required. The second argument is optional and contains an alias to give to the session created. If no alias is supplied, the package name is used as an alias.Another way to create SubWrapper components is to use the poeize method, which is included in the default export list of the package. You can simply do: poeize Data::Dumper;and Data::Dumper will be wrapped into a session with the alias 'Data::Dumper'.When a SubWrapper component is created, it scans the package named for subroutines, and creates one state in the session created with the same name of the subroutine.The states each accept 3 arguments:· An arrayref to a list of arguments to give the subroutine.· A state to callback with the results.· A string, either 'SCALAR', or 'ARRAY', allowing you to decide which context the function handled by this state will be called in.The states all call the function with the name matching the state, and give it the supplied arguments. They then postback the results to the named callback state. The results are contained in ARG0 and are either a scalar if the function was called in scalar context, or an arrayref of results if the function was called in list context. Requirements: · Perl


POE::Component::SubWrapper Related Software