##################################################################### # # This is a stripped down version of IO::ScalarArray # Given a reference to an array, it supplies either: # a getline method which reads lines (mode='r'), or # a print method which reads lines (mode='w') # # NOTE: this routine assumes that there aren't any embedded # newlines within any of the array elements. There are no checks # for that. # ##################################################################### package Perl::Tidy::IOScalarArray; use strict; use warnings; use Carp; our $VERSION = '20210111'; sub AUTOLOAD { # Catch any undefined sub calls so that we are sure to get # some diagnostic information. This sub should never be called # except for a programming error. our $AUTOLOAD; return if ( $AUTOLOAD =~ /\bDESTROY$/ ); my ( $pkg, $fname, $lno ) = caller(); my $my_package = __PACKAGE__; print STDERR <[1]; if ( $mode ne 'r' ) { confess <[2]++; return $self->[0]->[$i]; } sub print { my ( $self, $msg ) = @_; my $mode = $self->[1]; if ( $mode ne 'w' ) { confess <[0] }, $msg; return; } sub close { return } 1;