IO::Unread - push more than one character back onto a filehandle
use IO::Unread; unread STDIN, "hello world\n"; $_ = "goodbye"; unread ARGV;
IO::Unread exports one function,
unread, which will push data back onto a filehandle. Any amount of data can be pushed: if your perl is built with PerlIO layers, the data is stored in a special
:pending layer; if not, the module
ties the filehandle to a class which returns the unread data and unties itself.
unread unreads LIST onto FILEHANDLE. If LIST is omitted,
$_ is unread. Returns the number of characters unread on success,
undef on failure. Warnings are produced under category
unread $FH, 'a', 'b' is equivalent to
unread $FH, 'a'; unread $FH, 'b';
, ie. to
unread $FH, 'ba' rather than
unread $FH, 'ab'.
ungetc pushes the first character of STRING onto FILEHANDLE. Unlike
unread, it does not use a
tie implementation if your perl doesn't support PerlIO layers; rather it calls your ungetc(3). This is only guarenteed to support one character of pushback, and then only if it is the last character that was read from the handle.
None by default;
ungetc on request.
ungetc is subject to the whims of your libc if you're not using perlio.
Copyright 2003 Ben Morrow <firstname.lastname@example.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.