| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | Tie::FileHandle::MultiPlex - filehandle tie that sends output to many destinations | ||
| 6 | |||
| 7 | =head1 DESCRIPTION | ||
| 8 | |||
| 9 | This module, when tied to a filehandle, will send all of its output to all | ||
| 10 | of the sources listed upon its creation. | ||
| 11 | |||
| 12 | Usage: tie *HANDLE, 'Tie::FileHandle::MultiPlex', *HANDLE1, *HANDLE2, *HANDLE3,... | ||
| 13 | |||
| 14 | =head1 TODO | ||
| 15 | |||
| 16 | =over 4 | ||
| 17 | |||
| 18 | =item * | ||
| 19 | |||
| 20 | test.pl | ||
| 21 | |||
| 22 | =back | ||
| 23 | |||
| 24 | =head1 BUGS | ||
| 25 | |||
| 26 | This is a new module and has not been thoroughly tested. | ||
| 27 | |||
| 28 | =cut | ||
| 29 | |||
| 30 | package Tie::FileHandle::MultiPlex; | ||
| 31 | |||
| 32 | 1 | ▶ | use base qw(Tie::FileHandle::Base); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 33 | 1 | ▶ | use vars qw($VERSION); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 34 | 1 | $VERSION = 0.1; | |
| 35 | |||
| 36 | # TIEHANDLE | ||
| 37 | # Usage: tie *HANDLE, 'Tie::FileHandle::MultiPlex', *HANDLE1, *HANDLE2, *HANDLE3,... | ||
| 38 | 0 | ▶ | sub TIEHANDLE { |
|
Subroutine
TIEHANDLE: not called CC=1 SCAR=6.9
| |||
| 39 | 0 | bless [ map { \$_ } @_[1..$#_] ], $_[0]; | |
| 40 | } | ||
| 41 | |||
| 42 | |||
| 43 | 0 | ▶ | sub PRINT { |
|
Subroutine
PRINT: not called CC=2 SCAR=17.9
| |||
| 44 | 0 | print $_ $_[1] for @{ $_[0] }; | |
| 45 | } | ||
| 46 | |||
| 47 | 1 | 1; | |
| 48 | |||
| 49 | =head1 AUTHORS AND COPYRIGHT | ||
| 50 | |||
| 51 | Written by Robby Walker ( robwalker@cpan.org ) for Point Writer ( http://www.pointwriter.com/ ). | ||
| 52 | |||
| 53 | You may redistribute/modify/etc. this module under the same terms as Perl itself. | ||