| 1 | # Copyright 2008, 2009, 2010, 2011, 2012, 2017 Kevin Ryde | ||||||||||
| 2 | |||||||||||
| 3 | # This file is part of PerlIO-via-EscStatus. | ||||||||||
| 4 | # | ||||||||||
| 5 | # PerlIO-via-EscStatus is free software; you can redistribute it and/or | ||||||||||
| 6 | # modify it under the terms of the GNU General Public License as published | ||||||||||
| 7 | # by the Free Software Foundation; either version 3, or (at your option) any | ||||||||||
| 8 | # later version. | ||||||||||
| 9 | # | ||||||||||
| 10 | # PerlIO-via-EscStatus is distributed in the hope that it will be useful, | ||||||||||
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||||||||||
| 13 | # Public License for more details. | ||||||||||
| 14 | # | ||||||||||
| 15 | # You should have received a copy of the GNU General Public License along | ||||||||||
| 16 | # with PerlIO-via-EscStatus. If not, see <http://www.gnu.org/licenses/>. | ||||||||||
| 17 | |||||||||||
| 18 | package PerlIO::via::EscStatus::ShowAll; | ||||||||||
| 19 | 1 | ▶ | use 5.008; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | 1 | ▶ | use PerlIO::via::EscStatus; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | 1 | ▶ | use PerlIO::via::EscStatus::Parser; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 24 | |||||||||||
| 25 | 1 | our $VERSION = 12; | |||||||||
| 26 | |||||||||||
| 27 | 1 | ▶ | use constant DEBUG => 0; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | |||||||||||
| 29 | 2 | ▶ | sub PUSHED { | ||||||||
|
Subroutine
PUSHED: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 30 | 2 | my ($class, $mode, $fh) = @_; | |||||||||
| 31 | 2 | if (DEBUG) { | |||||||||
| 32 | require Data::Dumper; | ||||||||||
| 33 | print STDERR "ShowAll pushed ", Data::Dumper::Dumper ([$class,$mode,$fh]); | ||||||||||
| 34 | } | ||||||||||
| 35 | 2 | return bless { partial => '' }, $class; | |||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 1 | *UTF8 = \&PerlIO::via::EscStatus::UTF8; | |||||||||
| 39 | 1 | *FLUSH = \&PerlIO::via::EscStatus::FLUSH; | |||||||||
| 40 | |||||||||||
| 41 | 6 | ▶ | sub WRITE { | ||||||||
|
Subroutine
WRITE: called CC=3 SCAR=11.1
| |||||||||||
| 42 | 6 | my ($self, $buf, $fh) = @_; | |||||||||
| 43 | 6 | my $ret_ok = length ($buf); | |||||||||
| 44 | 6 | if (DEBUG) { print STDERR "ShowAll write $ret_ok\n"; } | |||||||||
| 45 | |||||||||||
| 46 | 6 | $buf = $self->{'partial'} . $buf; | |||||||||
| 47 | |||||||||||
| 48 | # complete sequences | ||||||||||
| 49 | 6 | $buf =~ s/\e_EscStatus\e\\//g; | |||||||||
| 50 | |||||||||||
| 51 | 6 | ▶ | my $pos | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | = ($buf =~ PerlIO::via::EscStatus::Parser::ESCSTATUS_STR_PARTIAL_REGEXP() | ||||||||||
| 53 | ? $-[0] # start of match | ||||||||||
| 54 | : length ($buf)); | ||||||||||
| 55 | 6 | $self->{'partial'} = substr ($buf, $pos); # match onwards | |||||||||
| 56 | 6 | $buf = substr ($buf, 0, $pos); # prematch | |||||||||
| 57 | |||||||||||
| 58 | 6 | ▶ | print $fh $buf or return -1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 59 | 6 | return $ret_ok; | |||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | 1 | 1; | |||||||||
| 63 | __END__ | ||||||||||