NAME
Module::AnyEvent::Helper::PPI::Transform - PPI::Transform subclass for AnyEvent-ize helper
SYNOPSIS
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.
DESCRIPTION
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.Translate (ordinary) methods to _async methods.
Emit
my $___cv___ = AE::cv;
at the beginning of the methods.Emit
return $___cv___;
at the end of the methods.Replace method calls with pairs of
Module::AnyEvent::Helper::bind_scalar
andshift->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.
OPTIONS
-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.
METHODS
This module inherits all of PPI::Transform methods.
AUTHOR
Yasutaka ATARASHI <yakex@cpan.org>
LICENSE
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.