logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Test::Builder::IO::Scalar - A copy of IO::Scalar for Test::Builder

Authors

PrimaryMaintainer David F. Skoll (dfs@roaringpenguin.com). Principalauthor Eryq (eryq@zeegee.com). President, ZeeGee Software Inc (http://www.zeegee.com). Othercontributors The full set of contributors always includes the folks mentioned in "CHANGE LOG" in IO::Stringy. But just the same, special thanks to the following individuals for their invaluable contributions (if I've forgotten or misspelled your name, please email me!): AndyGlew, for contributing getc(). BrandonBrowning, for suggesting opened(). DavidRichter, for finding and fixing the bug in PRINTF(). EricL.Brine, for his offset-using read() and write() implementations. RichardJones, for his patches to massively improve the performance of getline() and add "sysread" and "syswrite". B.K.Oxley(binkley), for stringification and inheritance improvements, and sundry good ideas. DougWilson, for the IO::Handle inheritance and automatic tie-ing.

Description

This is a copy of IO::Scalar which ships with Test::Builder to support scalar references as filehandles on Perl 5.6. Newer versions of Perl simply use open()'s built in support. Test::Builder can not have dependencies on other modules without careful consideration, so its simply been copied into the distribution.

Name

Test::Builder::IO::Scalar - A copy of IO::Scalar for Test::Builder

See Also

IO::String, which is quite similar but which was designed more-recently and with an IO::Handle-like interface in mind, so you could mix OO- and native-filehandle usage without using tied(). Note: as of version 2.x, these classes all work like their IO::Handle counterparts, so we have comparable functionality to IO::String. perl v5.40.1 2025-07-27 Test::Builder::IO::Scalar(3perl)

Version

$Id: Scalar.pm,v 1.6 2005/02/10 21:21:53 dfs Exp $

Warnings

Perl's TIEHANDLE spec was incomplete prior to 5.005_57; it was missing support for seek(), tell(), and eof(). Attempting to use these functions with an IO::Scalar will not work prior to 5.005_57. IO::Scalar will not have the relevant methods invoked; and even worse, this kind of bug can lie dormant for a while. If you turn warnings on (via $^W or "perl -w"), and you see something like this... attempt to seek on unopened filehandle ...then you are probably trying to use one of these functions on an IO::Scalar with an old Perl. The remedy is to simply use the OO version; e.g.: $SH->seek(0,0); ### GOOD: will work on any 5.005 seek($SH,0,0); ### WARNING: will only work on 5.005_57 and beyond

See Also