line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Message::Passing::Input::STDIN; |
2
|
4
|
|
|
4
|
|
106334
|
use Moo; |
|
4
|
|
|
|
|
12313
|
|
|
4
|
|
|
|
|
24
|
|
3
|
4
|
|
|
4
|
|
3561
|
use AnyEvent; |
|
4
|
|
|
|
|
5684
|
|
|
4
|
|
|
|
|
134
|
|
4
|
4
|
|
|
4
|
|
670
|
use Try::Tiny; |
|
4
|
|
|
|
|
1530
|
|
|
4
|
|
|
|
|
282
|
|
5
|
4
|
|
|
4
|
|
35
|
use Scalar::Util qw/ weaken /; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
250
|
|
6
|
4
|
|
|
4
|
|
543
|
use namespace::clean -except => 'meta'; |
|
4
|
|
|
|
|
10052
|
|
|
4
|
|
|
|
|
44
|
|
7
|
4
|
|
|
4
|
|
3752
|
use IO::Handle; |
|
4
|
|
|
|
|
25910
|
|
|
4
|
|
|
|
|
890
|
|
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 = <STDIN>; |
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
|
53
|
my $self = shift; |
32
|
4
|
|
|
|
|
71
|
$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<exit> to terminate the program. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 SEE ALSO |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
L<Message::Passing> |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 SPONSORSHIP |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
This module exists due to the wonderful people at Suretec Systems Ltd. |
62
|
|
|
|
|
|
|
<http://www.suretecsystems.com/> who sponsored its development for its |
63
|
|
|
|
|
|
|
VoIP division called SureVoIP <http://www.surevoip.co.uk/> for use with |
64
|
|
|
|
|
|
|
the SureVoIP API - |
65
|
|
|
|
|
|
|
<http://www.surevoip.co.uk/support/wiki/api_documentation> |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 AUTHOR, COPYRIGHT AND LICENSE |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
See L<Message::Passing>. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|