line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::Print::Many; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
204205
|
use warnings; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
47
|
|
4
|
2
|
|
|
2
|
|
7
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
26
|
|
5
|
2
|
|
|
2
|
|
6
|
use Carp; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
73
|
|
6
|
2
|
|
|
2
|
|
709
|
use namespace::autoclean; |
|
2
|
|
|
|
|
25623
|
|
|
2
|
|
|
|
|
5
|
|
7
|
|
|
|
|
|
|
require Tie::Handle; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
File::Print::Many - Print to more than one file descriptor at once |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Version 0.01 |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
20
|
|
|
|
|
|
|
our @ISA = ('Tie::Handle'); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Print to more than one file descriptor at once. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 new |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $many = File::Print::Many(fds => [$fout1, $fout2]); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub new { |
35
|
8
|
|
|
8
|
1
|
12694
|
my $proto = shift; |
36
|
8
|
|
33
|
|
|
25
|
my $class = ref($proto) || $proto; |
37
|
|
|
|
|
|
|
|
38
|
8
|
50
|
|
|
|
15
|
return unless(defined($class)); |
39
|
|
|
|
|
|
|
|
40
|
8
|
|
|
|
|
9
|
my %params; |
41
|
8
|
100
|
|
|
|
22
|
if(ref($_[0]) eq 'HASH') { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
42
|
3
|
|
|
|
|
3
|
%params = %{$_[0]}; |
|
3
|
|
|
|
|
8
|
|
43
|
|
|
|
|
|
|
} elsif(ref($_[0]) eq 'ARRAY') { |
44
|
1
|
|
|
|
|
3
|
$params{'fds'} = shift; |
45
|
|
|
|
|
|
|
# } elsif(ref($_[0])) { |
46
|
|
|
|
|
|
|
# Carp::croak('Usage: new(fds => \@array)'); |
47
|
|
|
|
|
|
|
} elsif(scalar(@_) % 2 == 0) { |
48
|
4
|
|
|
|
|
8
|
%params = @_; |
49
|
|
|
|
|
|
|
} else { |
50
|
0
|
|
|
|
|
0
|
Carp::croak('Usage: new(fds => \@array)'); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
8
|
100
|
100
|
|
|
21
|
if((ref($params{fds}) ne 'ARRAY') || |
54
|
4
|
|
|
|
|
11
|
!defined(@{$params{fds}}[0])) { |
55
|
5
|
|
|
|
|
8
|
Carp::croak('Usage: new(fds => \@array)'); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
return bless { |
59
|
3
|
|
|
|
|
16
|
_fds => $params{'fds'} |
60
|
|
|
|
|
|
|
}, $class; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 print |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Send output. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
$many->print("hello, world!\n"); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# sub PRINT { |
72
|
|
|
|
|
|
|
# my $self = shift; |
73
|
|
|
|
|
|
|
# |
74
|
|
|
|
|
|
|
# foreach my $fd(@{$self->{'_fds'}}) { |
75
|
|
|
|
|
|
|
# print $fd @_; |
76
|
|
|
|
|
|
|
# } |
77
|
|
|
|
|
|
|
# } |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# sub TIEHANDLE { |
80
|
|
|
|
|
|
|
# bless \"$_[0]",$_[0]; |
81
|
|
|
|
|
|
|
# } |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub print { |
84
|
3
|
|
|
3
|
1
|
11
|
my $self = shift; |
85
|
3
|
|
|
|
|
7
|
my @data = @_; |
86
|
|
|
|
|
|
|
|
87
|
3
|
|
|
|
|
2
|
foreach my $fd(@{$self->{'_fds'}}) { |
|
3
|
|
|
|
|
37
|
|
88
|
6
|
|
|
|
|
40
|
print $fd @data; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 AUTHOR |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Nigel Horne, C<< >> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 BUGS |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, |
99
|
|
|
|
|
|
|
or through the web interface at |
100
|
|
|
|
|
|
|
L. |
101
|
|
|
|
|
|
|
I will be notified, and then you'll |
102
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 SEE ALSO |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
L |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 SUPPORT |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
perldoc File::Print::Many |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
You can also look for information at: |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=over 4 |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
L |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
L |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=item * CPAN Ratings |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
L |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=item * Search CPAN |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
L |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=back |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Copyright 2018 Nigel Horne. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
This program is released under the following licence: GPL |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=cut |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
1; |