Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
AnyEvent::Subprocess::UsernContributedpPerlsDocumentaWithDelegates::Manager(3)

NAME
       AnyEvent::Subprocess::Role::WithDelegates::Manager - manage delegate
       shortcuts

VERSION
       version 1.102912

DESCRIPTION
       Creating	an instance of a delegate to pass to "AnyEvent::Subprocess"'s
       constructor is tedious.	This module maps sugary	names to builders of
       delegate	objects, so that the user can say 'Foo'	instead	of
       "AnyEvent::Subprocess::Job::Delegate::Foo->new".

       If you are writing a delegate for "AnyEvent::Subprocess", simply	call
       "register_delegate" in your module.  When the users "use"s your module,
       the sugary name will become available.  And yeah, it's global, so be
       careful.

EXPORTS
       None by default,	but you	can request "register_delegate"	and
       "build_delegate".

FUNCTIONS
   register_delegate( $name, &$builder )
       Register	$builder to build delegates named $name.  $builder is a
       coderef that is eventually called with the key/value pairs supplied by
       the user.  (The docs say	this has to be a hashref, but it can actually
       be any scalar value.  Checking is up to you.)  The builder must return
       an instance of a	class that does	AnyEvent::Subprocess::Delegate,
       although	this condition is not checked by this module.  (You will get a
       type error when you are building	the class that uses the	delegate.)

       In the common case where	the args should	be passed directly to some
       class' constructor, you can just	supply the class name as the $builder.
       "new" will be called with any args the user supplies.

       You get a noisy warning if you reuse a $name.  This is almost always an
       error, though; only the most recent name/builder	pair is	remembered.

   build_delegate( $spec )
       Given a $spec, return an	instance of the	correct	delegate.  Dies	if we
       don't know how to build a delegate according to $spec.

       $spec can be a string naming the	delegate to be built, or it can	be a
       hashref or arrayref of name/args	pair.  Name is the same	name passed to
       "register_delegate", and	the args should	be a hashref.

SEE ALSO
       AnyEvent::Subprocess

       AnyEvent::Subprocess::Delegate

       AnyEvent::Subprocess::Role::WithDelegates

AUTHOR
       Jonathan	Rockway	<jrockway@cpan.org>

COPYRIGHT AND LICENSE
       This software is	copyright (c) 2011 by Jonathan Rockway.

       This is free software; you can redistribute it and/or modify it under
       the same	terms as the Perl 5 programming	language system	itself.

perl v5.32.0		 AnyEvent::Subprocess::Role::WithDelegates::Manager(3)

NAME | VERSION | DESCRIPTION | EXPORTS | FUNCTIONS | SEE ALSO | AUTHOR | COPYRIGHT AND LICENSE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=AnyEvent::Subprocess::Role::WithDelegates::Manager&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>

home | help