line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Message::Passing::Input::STDIN; |
2
|
4
|
|
|
4
|
|
25890
|
use Moo; |
|
4
|
|
|
|
|
18027
|
|
|
4
|
|
|
|
|
25
|
|
3
|
4
|
|
|
4
|
|
4330
|
use AnyEvent; |
|
4
|
|
|
|
|
17620
|
|
|
4
|
|
|
|
|
119
|
|
4
|
4
|
|
|
4
|
|
1250
|
use Try::Tiny; |
|
4
|
|
|
|
|
1600
|
|
|
4
|
|
|
|
|
287
|
|
5
|
4
|
|
|
4
|
|
24
|
use Scalar::Util qw/ weaken /; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
300
|
|
6
|
4
|
|
|
4
|
|
1057
|
use namespace::clean -except => 'meta'; |
|
4
|
|
|
|
|
14599
|
|
|
4
|
|
|
|
|
39
|
|
7
|
4
|
|
|
4
|
|
3651
|
use IO::Handle; |
|
4
|
|
|
|
|
18129
|
|
|
4
|
|
|
|
|
1129
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
with qw/ |
10
|
|
|
|
|
|
|
Message::Passing::Role::Input |
11
|
|
|
|
|
|
|
/; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has reader => ( |
14
|
|
|
|
|
|
|
is => 'ro', |
15
|
|
|
|
|
|
|
lazy => 1, |
16
|
|
|
|
|
|
|
default => sub { |
17
|
|
|
|
|
|
|
my $self = shift; |
18
|
|
|
|
|
|
|
weaken($self); |
19
|
|
|
|
|
|
|
AnyEvent->io(fh => \*STDIN, poll => 'r', cb => sub { |
20
|
|
|
|
|
|
|
exit 0 if STDIN->eof; |
21
|
|
|
|
|
|
|
my $input = ; |
22
|
|
|
|
|
|
|
return unless defined $input; |
23
|
|
|
|
|
|
|
chomp($input); |
24
|
|
|
|
|
|
|
return unless length $input; |
25
|
|
|
|
|
|
|
$self->output_to->consume($input); |
26
|
|
|
|
|
|
|
}); |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub BUILD { |
31
|
4
|
|
|
4
|
0
|
79
|
my $self = shift; |
32
|
4
|
|
|
|
|
41
|
$self->reader; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 NAME |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Message::Passing::Input::STDIN - STDIN input |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 SYNOPSIS |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
message-pass --input STDIN --output STDOUT |
45
|
|
|
|
|
|
|
{"foo": "bar"} |
46
|
|
|
|
|
|
|
{"foo":"bar"} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 DESCRIPTION |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
An input which gets messages from STDIN. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Messages are expected to be c<\n> separated, and if EOF is encountered |
53
|
|
|
|
|
|
|
then this input will call C to terminate the program. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 SEE ALSO |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
L |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 SPONSORSHIP |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
This module exists due to the wonderful people at Suretec Systems Ltd. |
62
|
|
|
|
|
|
|
who sponsored its development for its |
63
|
|
|
|
|
|
|
VoIP division called SureVoIP for use with |
64
|
|
|
|
|
|
|
the SureVoIP API - |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 AUTHOR, COPYRIGHT AND LICENSE |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
See L. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|