| AnyEvent-Subprocess documentation | Contained in the AnyEvent-Subprocess distribution. |
AnyEvent::Subprocess::Types - MooseX::Types used internally
version 1.102912
Direction
JobDelegate
RunDelegate
DoneDelegate
SubprocessCode
CodeList
WhenToCallBack
Jonathan Rockway <jrockway@cpan.org>
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.
| AnyEvent-Subprocess documentation | Contained in the AnyEvent-Subprocess distribution. |
package AnyEvent::Subprocess::Types; BEGIN { $AnyEvent::Subprocess::Types::VERSION = '1.102912'; } # ABSTRACT: C<MooseX::Types> used internally use MooseX::Types -declare => [ qw{ Direction JobDelegate RunDelegate DoneDelegate SubprocessCode CodeList WhenToCallBack }]; use MooseX::Types::Moose qw(Str ArrayRef CodeRef); subtype Direction, as Str, where { $_ eq 'r' || $_ eq 'w' || $_ eq 'rw' }; role_type JobDelegate, { role => 'AnyEvent::Subprocess::Job::Delegate' }; role_type RunDelegate, { role => 'AnyEvent::Subprocess::Running::Delegate' }; role_type DoneDelegate, { role => 'AnyEvent::Subprocess::Done::Delegate' }; subtype SubprocessCode, as CodeRef; coerce SubprocessCode, from Str, via { my $cmd = $_; return sub { no warnings; exec $cmd or die "Failed to exec '$cmd': $!" }; }; coerce SubprocessCode, from ArrayRef[Str], via { my $cmd = $_; my $str = join ' ', @$cmd; return sub { no warnings; exec @$cmd or die "Failed to exec '$str': $!" }; }; subtype CodeList, as ArrayRef[CodeRef]; coerce CodeList, from CodeRef, via { [$_] }; enum WhenToCallBack, qw/Readable Line/; 1;
__END__