Subprocess/Job/Delegate/CaptureHandle.pm

filter: Statementstmt 100% 18 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 12 / 12 Podpod 0.0% 0 / 8 totaltotal 78.9% 30 / 38 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Subprocess/Job/Delegate/Timeout.pm ↑ Summary Subprocess/Running/Delegate/Timeout.pm »
1 package AnyEvent::Subprocess::Job::Delegate::CaptureHandle;
2 48 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 48 $AnyEvent::Subprocess::Job::Delegate::CaptureHandle::VERSION = '1.102912';
4 }
5 # ABSTRACT: capture the data that comes in via a handle
6 48 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 48 ▶use AnyEvent::Subprocess::Running::Delegate::CaptureHandle;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 47 with 'AnyEvent::Subprocess::Job::Delegate';
10  
11 47 has 'handle' => (
12 is => 'ro',
13 isa => 'Str',
14 required => 1,
15 );
16  
17 26 ▶sub build_run_delegates {
Subroutine build_run_delegates: called CC=1 SCAR=0.0
Pod undocumented
18 26 my $self = shift;
19 26 return AnyEvent::Subprocess::Running::Delegate::CaptureHandle->new(
20 name => $self->name,
21 );
22 }
23  
24 26 ▶sub parent_setup_hook {
Subroutine parent_setup_hook: called CC=1 SCAR=0.0
Pod undocumented
25 26 my ($self, $job, $run) = @_;
26  
27 14 ▶ $run->delegate($self->handle)->handle->on_read( sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
28 14 my ($handle) = @_;
29 14 my $buf = delete $handle->{rbuf};
30 14 $run->delegate($self->name)->_append_output($buf);
31 26 });
32 }
33  
34 11 ▶sub build_code_args {}
Subroutine build_code_args: called CC=1 SCAR=0.0
Pod undocumented
35 6 ▶sub child_finalize_hook {}
Subroutine child_finalize_hook: called CC=1 SCAR=0.0
Pod undocumented
36 11 ▶sub child_setup_hook {}
Subroutine child_setup_hook: called CC=1 SCAR=0.0
Pod undocumented
37 15 ▶sub parent_finalize_hook {}
Subroutine parent_finalize_hook: called CC=1 SCAR=0.0
Pod undocumented
38 5 ▶sub receive_child_result {}
Subroutine receive_child_result: called CC=1 SCAR=0.0
Pod undocumented
39 1 ▶sub receive_child_error {}
Subroutine receive_child_error: called CC=1 SCAR=0.0
Pod undocumented
40  
41 47 __PACKAGE__->meta->make_immutable;
42  
43 47 1;
44  
45  
46  
47 =pod
48  
49 =head1 NAME
50  
51 AnyEvent::Subprocess::Job::Delegate::CaptureHandle - capture the data that comes in via a handle
52  
53 =head1 VERSION
54  
55 version 1.102912
56  
57 =head1 DESCRIPTION
58  
59 If you have a Handle delegate and just want to save the output
60 somewhere, use this delegate. It accepts the name of the delegate,
61 reads from the handle while the process is running, and makes all the
62 output available via the Done instance.
63  
64 =head1 INITARGS
65  
66 =head2 handle
67  
68 The name of the handle you want to capture's delegate.
69  
70 =head1 AUTHOR
71  
72 Jonathan Rockway <jrockway@cpan.org>
73  
74 =head1 COPYRIGHT AND LICENSE
75  
76 This software is copyright (c) 2011 by Jonathan Rockway.
77  
78 This is free software; you can redistribute it and/or modify it under
79 the same terms as the Perl 5 programming language system itself.
80  
81 =cut
82  
83  
84 __END__
« Subprocess/Job/Delegate/Timeout.pm ↑ Summary Subprocess/Running/Delegate/Timeout.pm »