in reply to PerlIO::via FILL subroutine question
If I guessed correctly, there are other ways to do it - speak up.package rdw; use strict; use warnings; sub PUSHED { bless \*PUSHED,$_[0] } sub FILL { my ($length, $record); read $_[1], $length, 1; return undef if eof $_[1]; read $_[1], $record, $length; # uncomment next line to see it is actually working # print "$record\n"; return $record; } sub WRITE { return undef } package main; open( my $in, '<:via(rdw)', 'foo.txt' ) or die $!; while ( <$in> ) { print "$_\n"; } __END__ # foo.txt - output is aababc 1a2ab3abc
Cheers - L~R
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: PerlIO::via FILL subroutine question
by thor (Priest) on Oct 04, 2004 at 22:31 UTC | |
by Limbic~Region (Chancellor) on Oct 05, 2004 at 00:53 UTC |