1Test::Builder::IO::ScalUasre(r3)Contributed Perl DocumenTteastti:o:nBuilder::IO::Scalar(3)
2
3
4

NAME

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

DESCRIPTION

9       This is a copy of IO::Scalar which ships with Test::Builder to support
10       scalar references as filehandles on Perl 5.6.  Newer versions of Perl
11       simply use "open()"'s built in support.
12
13       Test::Builder can not have dependencies on other modules without
14       careful consideration, so its simply been copied into the distribution.
15
17       This file came from the "IO-stringy" Perl5 toolkit.
18
19       Copyright (c) 1996 by Eryq.  All rights reserved.  Copyright (c)
20       1999,2001 by ZeeGee Software Inc.  All rights reserved.
21
22       This program is free software; you can redistribute it and/or modify it
23       under the same terms as Perl itself.
24
25   Construction
26       new [ARGS...]
27           Class method.  Return a new, unattached scalar handle.  If any
28           arguments are given, they're sent to open().
29
30       open [SCALARREF]
31           Instance method.  Open the scalar handle on a new scalar, pointed
32           to by SCALARREF.  If no SCALARREF is given, a "private" scalar is
33           created to hold the file data.
34
35           Returns the self object on success, undefined on error.
36
37       opened
38           Instance method.  Is the scalar handle opened on something?
39
40       close
41           Instance method.  Disassociate the scalar handle from its
42           underlying scalar.  Done automatically on destroy.
43
44   Input and output
45       flush
46           Instance method.  No-op, provided for OO compatibility.
47
48       getc
49           Instance method.  Return the next character, or undef if none
50           remain.
51
52       getline
53           Instance method.  Return the next line, or undef on end of string.
54           Can safely be called in an array context.  Currently, lines are
55           delimited by "\n".
56
57       getlines
58           Instance method.  Get all remaining lines.  It will croak() if
59           accidentally called in a scalar context.
60
61       print ARGS...
62           Instance method.  Print ARGS to the underlying scalar.
63
64           Warning: this continues to always cause a seek to the end of the
65           string, but if you perform seek()s and tell()s, it is still safer
66           to explicitly seek-to-end before subsequent print()s.
67
68       read BUF, NBYTES, [OFFSET]
69           Instance method.  Read some bytes from the scalar.  Returns the
70           number of bytes actually read, 0 on end-of-file, undef on error.
71
72       write BUF, NBYTES, [OFFSET]
73           Instance method.  Write some bytes to the scalar.
74
75       sysread BUF, LEN, [OFFSET]
76           Instance method.  Read some bytes from the scalar.  Returns the
77           number of bytes actually read, 0 on end-of-file, undef on error.
78
79       syswrite BUF, NBYTES, [OFFSET]
80           Instance method.  Write some bytes to the scalar.
81
82   Seeking/telling and other attributes
83       autoflush
84           Instance method.  No-op, provided for OO compatibility.
85
86       binmode
87           Instance method.  No-op, provided for OO compatibility.
88
89       clearerr
90           Instance method.  Clear the error and EOF flags.  A no-op.
91
92       eof Instance method.  Are we at end of file?
93
94       seek OFFSET, WHENCE
95           Instance method.  Seek to a given position in the stream.
96
97       sysseek OFFSET, WHENCE
98           Instance method. Identical to "seek OFFSET, WHENCE", q.v.
99
100       tell
101           Instance method.  Return the current position in the stream, as a
102           numeric offset.
103
104       use_RS [YESNO]
105           Instance method.  Deprecated and ignored.  Obey the current setting
106           of $/, like IO::Handle does?  Default is false in 1.x, but cold-
107           welded true in 2.x and later.
108
109       setpos POS
110           Instance method.  Set the current position, using the opaque value
111           returned by "getpos()".
112
113       getpos
114           Instance method.  Return the current position in the string, as an
115           opaque object.
116
117       sref
118           Instance method.  Return a reference to the underlying scalar.
119

WARNINGS

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

VERSION

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

AUTHORS

141   Primary Maintainer
142       David F. Skoll (dfs@roaringpenguin.com).
143
144   Principal author
145       Eryq (eryq@zeegee.com).  President, ZeeGee Software Inc
146       (http://www.zeegee.com).
147
148   Other contributors
149       The full set of contributors always includes the folks mentioned in
150       "CHANGE LOG" in IO::Stringy.  But just the same, special thanks to the
151       following individuals for their invaluable contributions (if I've
152       forgotten or misspelled your name, please email me!):
153
154       Andy Glew, for contributing "getc()".
155
156       Brandon Browning, for suggesting "opened()".
157
158       David Richter, for finding and fixing the bug in "PRINTF()".
159
160       Eric L. Brine, for his offset-using read() and write() implementations.
161
162       Richard Jones, for his patches to massively improve the performance of
163       "getline()" and add "sysread" and "syswrite".
164
165       B. K. Oxley (binkley), for stringification and inheritance
166       improvements, and sundry good ideas.
167
168       Doug Wilson, for the IO::Handle inheritance and automatic tie-ing.
169

SEE ALSO

171       IO::String, which is quite similar but which was designed more-recently
172       and with an IO::Handle-like interface in mind, so you could mix OO- and
173       native-filehandle usage without using tied().
174
175       Note: as of version 2.x, these classes all work like their IO::Handle
176       counterparts, so we have comparable functionality to IO::String.
177
178
179
180perl v5.36.0                      2022-07-22      Test::Builder::IO::Scalar(3)
Impressum