| 1 | # | ||
| 2 | # Copyright (c) 2015 Christian Jaeger, copying@christianjaeger.ch | ||
| 3 | # | ||
| 4 | # This is free software, offered under either the same terms as perl 5 | ||
| 5 | # or the terms of the Artistic License version 2 or the terms of the | ||
| 6 | # MIT License (Expat version). See the file COPYING.md that came | ||
| 7 | # bundled with this file. | ||
| 8 | # | ||
| 9 | |||
| 10 | =head1 NAME | ||
| 11 | |||
| 12 | Chj::IO::WrappedFile | ||
| 13 | |||
| 14 | =head1 SYNOPSIS | ||
| 15 | |||
| 16 | use Chj::xopen 'fh_to_fh'; | ||
| 17 | my $fh = fh_to_fh ($some_pty_or_so); | ||
| 18 | # which is the same as: | ||
| 19 | my $fh2 = Chj::IO::WrappedFile->new ($some_pty_or_so); | ||
| 20 | |||
| 21 | # $fh and $fh2 are Chj::IO::WrappedFile objects *containing* | ||
| 22 | # $some_pty_or_so | ||
| 23 | $fh->dup2(0) # etc., all Chj::IO::File methods | ||
| 24 | |||
| 25 | =head1 DESCRIPTION | ||
| 26 | |||
| 27 | This is a type wrapper to provide the Chj::IO::File methods for all | ||
| 28 | kinds of Perl filehandles. | ||
| 29 | |||
| 30 | =head1 NOTE | ||
| 31 | |||
| 32 | This is alpha software! Read the status section in the package README | ||
| 33 | or on the L<website|http://functional-perl.org/>. | ||
| 34 | |||
| 35 | =cut | ||
| 36 | |||
| 37 | package Chj::IO::WrappedFile; | ||
| 38 | |||
| 39 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 40 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 41 | 1 | ▶ | use warnings FATAL => 'uninitialized'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 42 | |||
| 43 | 1 | ▶ | use base 'Chj::IO::File'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 44 | |||
| 45 | 0 | ▶ | sub new { |
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 46 | 0 | my $class = shift; | |
| 47 | 0 | bless [@_], $class | |
| 48 | } | ||
| 49 | |||
| 50 | 0 | ▶ | sub fh { |
|
Subroutine
fh: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 51 | 0 | $_[0][0] | |
| 52 | } | ||
| 53 | |||
| 54 | 1 | 1 | |