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