line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Message::Passing::Output::IO::Handle; |
2
|
1
|
|
|
1
|
|
1726
|
use Moo; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
9
|
|
3
|
|
|
|
|
|
|
#use Moose::Util::TypeConstraints; |
4
|
1
|
|
|
1
|
|
429
|
use namespace::clean -except => 'meta'; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
26
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
with 'Message::Passing::Role::Output'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has fh => ( |
9
|
|
|
|
|
|
|
# isa => duck_type([qw/ print /]), |
10
|
|
|
|
|
|
|
is => 'ro', |
11
|
|
|
|
|
|
|
required => 1, |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has append => ( |
15
|
|
|
|
|
|
|
is => 'ro', |
16
|
|
|
|
|
|
|
default => sub { "\n" }, |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub consume { |
20
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
21
|
0
|
|
|
|
|
|
$self->fh->print(shift() . $self->append); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 NAME |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Message::Passing::Output::IO::Handle - output to an IO handle |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 SYNOPSIS |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $out = Message::Passing::Output::IO::Handle->new( |
34
|
|
|
|
|
|
|
fh => \*STDOUT, |
35
|
|
|
|
|
|
|
append => "\n", |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
# $out will now act like Message::Passing::Output::STDOUT |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 DESCRIPTION |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Output messages to an L like handle, i.e. any class |
42
|
|
|
|
|
|
|
which implements a C<< ->print($stuff) >> method. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 fh |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
The file handle object. Required. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 append |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
String to append to each message. Defaults to "\n" |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 METHODS |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 consume |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Consumes a message by printing it, followed by \n |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 SEE ALSO |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
L |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 SPONSORSHIP |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This module exists due to the wonderful people at Suretec Systems Ltd. |
67
|
|
|
|
|
|
|
who sponsored its development for its |
68
|
|
|
|
|
|
|
VoIP division called SureVoIP for use with |
69
|
|
|
|
|
|
|
the SureVoIP API - |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 AUTHOR, COPYRIGHT AND LICENSE |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
See L. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |