Module::AnyEvent::Helper::PPI::Transform - PPI::Transform subclass for AnyEvent-ize helper
version v0.0.3
Typically, this module is not used directly but used via Module::AnyEvent::Helper::Filter. Of course, however, you can use this module directly.
my $trans = Module::AnyEvent::Helper::PPI::Transform->new( -remove_func => [qw()], -translate_func => [qw()] ); $trans->file('Input.pm' => 'Output.pm');
NOTE that this module itself does not touch package name.
To make some modules AnyEvent-frinedly, it might be necessary to write boiler-plate codes. This module applys the following transformations.
Emit use AnyEvent;use Module::AnyEvent::Helper; at the beginning of the document.
use AnyEvent;use Module::AnyEvent::Helper;
Translate (ordinary) methods to _async methods.
Emit my $___cv___ = AE::cv; at the beginning of the methods.
my $___cv___ = AE::cv;
Emit return $___cv___; at the end of the methods.
return $___cv___;
Replace method calls with pairs of Module::AnyEvent::Helper::bind_scalar and shift->recv.
Module::AnyEvent::Helper::bind_scalar
shift->recv
Delete methods you need to implement by yourself.
Create blocking wait methods from _async methods to emit Module::AnyEvent::Helper::strip_async_all();1; at the end of the packages.
Module::AnyEvent::Helper::strip_async_all();1;
This module inherits all of PPI::Transform methods.
-remove_func
Specify array reference of removing methods. If you want to implement async version of the methods, you specify them in this option.
-translate_func
Specify array reference of translating methods. You don't need to implement async version of these methods. This module translates implementation.
-replace_func
Specify array reference of replacing methods. It is expected that async version is implemented elsewhere.
-delete_func
Specify array reference of deleting methods. If you want to implement not async version of the methods, you specify them in this option.
Yasutaka ATARASHI <yakex@cpan.org>
This software is copyright (c) 2012 by Yasutaka ATARASHI.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Module::AnyEvent::Helper, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Module::AnyEvent::Helper
CPAN shell
perl -MCPAN -e shell install Module::AnyEvent::Helper
For more information on module installation, please visit the detailed CPAN module installation guide.