12 IO-stringy - I/O on in-core objects like strings and arrays
18 ::AtomicFile adpO Write a file which is updated atomically ERYQ
19 ::Lines bdpO I/O handle to read/write to array of lines ERYQ
20 ::Scalar RdpO I/O handle to read/write to a string ERYQ
21 ::ScalarArray RdpO I/O handle to read/write to array of scalars ERYQ
22 ::Wrap RdpO Wrap old-style FHs in standard OO interface ERYQ
23 ::WrapTie adpO Tie your handles & retain full OO interface ERYQ
28 This toolkit primarily provides modules for performing both traditional
29 and object-oriented i/o) on things I<other> than normal filehandles;
30 in particular, L<IO::Scalar|IO::Scalar>, L<IO::ScalarArray|IO::ScalarArray>,
31 and L<IO::Lines|IO::Lines>.
33 In the more-traditional IO::Handle front, we
34 have L<IO::AtomicFile|IO::AtomicFile>
35 which may be used to painlessly create files which are updated
38 And in the "this-may-prove-useful" corner, we have L<IO::Wrap|IO::Wrap>,
39 whose exported wraphandle() function will clothe anything that's not
40 a blessed object in an IO::Handle-like wrapper... so you can just
41 use OO syntax and stop worrying about whether your function's caller
42 handed you a string, a globref, or a FileHandle.
47 Perl's TIEHANDLE spec was incomplete prior to 5.005_57;
48 it was missing support for C<seek()>, C<tell()>, and C<eof()>.
49 Attempting to use these functions with an IO::Scalar, IO::ScalarArray,
50 IO::Lines, etc. B<will not work> prior to 5.005_57.
51 None of the relevant methods will be invoked by Perl;
52 and even worse, this kind of bug can lie dormant for a while.
53 If you turn warnings on (via C<$^W> or C<perl -w>), and you see
54 something like this...
56 seek() on unopened file
58 ...then you are probably trying to use one of these functions
59 on one of our IO:: classes with an old Perl. The remedy is to simply
60 use the OO version; e.g.:
62 $SH->seek(0,0); ### GOOD: will work on any 5.005
63 seek($SH,0,0); ### WARNING: will only work on 5.005_57 and beyond
72 As of version 2.x, this toolkit requires Perl 5.005 for
73 the IO::Handle subclasses, and 5.005_57 or better is
74 B<strongly> recommended. See L<"WARNINGS"> for details.
79 Most of you already know the drill...
86 For everyone else out there...
87 if you've never installed Perl code before, or you're trying to use
88 this in an environment where your sysadmin or ISP won't let you do
89 interesting things, B<relax:> since this module contains no binary
90 extensions, you can cheat. That means copying the directory tree
91 under my "./lib" directory into someplace where your script can "see"
92 it. For example, under Linux:
94 cp -r IO-stringy-1.234/lib/* /path/to/my/perl/
96 Now, in your Perl code, do this:
98 use lib "/path/to/my/perl";
99 use IO::Scalar; ### or whatever
101 Ok, now you've been told. At this point, anyone who whines about
102 not being given enough information gets an unflattering haiku
103 written about them in the next change log. I'll do it.
110 $Id: Stringy.pm,v 1.3 2005/02/10 21:24:05 dfs Exp $
118 =item (2000/08/02) Finalize $/ support
120 Graham Barr submitted this patch half a I<year> ago;
121 Like a moron, I lost his message under a ton of others,
122 and only now have the experimental implementation done.
124 Will the sudden sensitivity to $/ hose anyone out there?
125 I'm worried, so you have to enable it explicitly in 1.x.
126 It will be on by default in 2.x, though only IO::Scalar
127 has been implemented.
129 =item (2001/08/08) Remove IO::WrapTie from new IO:: classes
131 It's not needed. Backwards compatibility could be maintained
132 by having new_tie() be identical to new(). Heck, I'll bet
133 that IO::WrapTie should be reimplemented so the returned
134 object is just like an IO::Scalar in its use of globrefs.
146 =item Version 2.110 (2005/02/10)
148 Maintainership taken over by DSKOLL <dfs@roaringpenguin.com>
150 Closed the following bugs at
151 https://rt.cpan.org/NoAuth/Bugs.html?Dist=IO-stringy:
155 2208 IO::ScalarArray->getline does not return undef for EOF if undef($/)
159 7132 IO-stringy/Makefile.PL bug - name should be module name
163 11249 IO::Scalar flush shouldn't return undef
167 2172 $\ (output record separator) not respected
171 8605 IO::InnerFile::seek() should return 1 on success
179 4369 Improvement: handling of fixed-size reads in IO::Scalar
181 (Actually, bug 4369 was closed in Version 2.109)
183 =item Version 2.109 (2003/12/21)
185 IO::Scalar::getline now works with ref to int.
186 I<Thanks to Dominique Quatravaux for this patch.>
189 =item Version 2.108 (2001/08/20)
191 The terms-of-use have been placed in the distribution file "COPYING".
192 Also, small documentation tweaks were made.
195 =item Version 2.105 (2001/08/09)
197 Added support for various seek() whences to IO::ScalarArray.
199 Added support for consulting $/ in IO::Scalar and IO::ScalarArray.
200 The old C<use_RS()> is not even an option.
201 Unsupported record separators will cause a croak().
203 Added a lot of regression tests to supoprt the above.
205 Better on-line docs (hyperlinks to individual functions).
208 =item Version 2.103 (2001/08/08)
210 After sober consideration I have reimplemented IO::Scalar::print()
211 so that it once again always seeks to the end of the string.
212 Benchmarks show the new implementation to be just as fast as
213 Juergen's contributed patch; until someone can convince me otherwise,
214 the current, safer implementation stays.
216 I thought more about giving IO::Scalar two separate handles,
217 one for reading and one for writing, as suggested by Binkley.
218 His points about what tell() and eof() return are, I think,
219 show-stoppers for this feature. Even the manpages for stdio's fseek()
220 seem to imply a I<single> file position indicator, not two.
221 So I think I will take this off the TO DO list.
222 B<Remedy:> you can always have two handles open on the same
223 scalar, one which you only write to, and one which you only read from.
224 That should give the same effect.
227 =item Version 2.101 (2001/08/07)
230 This is the initial release of the "IO::Scalar and friends are
231 now subclasses of IO::Handle". I'm flinging it against the wall.
232 Please tell me if the banana sticks. When it does, the banana
235 First off, I<many many thanks to Doug Wilson>, who
236 has provided an I<invaluable> service by patching IO::Scalar
237 and friends so that they (1) inherit from IO::Handle, (2) automatically
238 tie themselves so that the C<new()> objects can be used in native i/o
239 constructs, and (3) doing it so that the whole damn thing passes
240 its regression tests. As Doug knows, my globref Kung-Fu was not
241 up to the task; he graciously provided the patches. This has earned
242 him a seat at the L<Co-Authors|"AUTHOR"> table, and the
243 right to have me address him as I<sensei>.
245 Performance of IO::Scalar::print() has been improved by as much as 2x
246 for lots of little prints, with the cost of forcing those
247 who print-then-seek-then-print to explicitly seek to end-of-string
248 before printing again.
249 I<Thanks to Juergen Zeller for this patch.>
251 Added the COPYING file, which had been missing from prior versions.
252 I<Thanks to Albert Chin-A-Young for pointing this out.>
254 IO::Scalar consults $/ by default (1.x ignored it by default).
255 Yes, I still need to support IO::ScalarArray.
258 =item Version 1.221 (2001/08/07)
260 I threatened in L<"INSTALLATION"> to write an unflattering haiku
261 about anyone who whined that I gave them insufficient information...
262 but it turns out that I left out a crucial direction. D'OH!
263 I<Thanks to David Beroff for the "patch" and the haiku...>
266 Here's unflattering haiku:
267 Forgot the line, "make"! ;-)
271 =item Version 1.220 (2001/04/03)
273 Added untested SEEK, TELL, and EOF methods to IO::Scalar
274 and IO::ScalarArray to support corresponding functions for
275 tied filehandles: untested, because I'm still running 5.00556
276 and Perl is complaining about "tell() on unopened file".
277 I<Thanks to Graham Barr for the suggestion.>
279 Removed not-fully-blank lines from modules; these were causing
280 lots of POD-related warnings.
281 I<Thanks to Nicolas Joly for the suggestion.>
284 =item Version 1.219 (2001/02/23)
286 IO::Scalar objects can now be made sensitive to $/ .
287 Pains were taken to keep the fast code fast while adding this feature.
288 I<Cheers to Graham Barr for submitting his patch;
289 jeers to me for losing his email for 6 months.>
292 =item Version 1.218 (2001/02/23)
294 IO::Scalar has a new sysseek() method.
295 I<Thanks again to Richard Jones.>
297 New "TO DO" section, because people who submit patches/ideas should
298 at least know that they're in the system... and that I won't lose
299 their stuff. Please read it.
301 New entries in L<"AUTHOR">.
302 Please read those too.
306 =item Version 1.216 (2000/09/28)
308 B<IO::Scalar and IO::ScalarArray now inherit from IO::Handle.>
309 I thought I'd remembered a problem with this ages ago, related to
310 the fact that these IO:: modules don't have "real" filehandles,
311 but the problem apparently isn't surfacing now.
312 If you suddenly encounter Perl warnings during global destruction
313 (especially if you're using tied filehandles), then please let me know!
314 I<Thanks to B. K. Oxley (binkley) for this.>
316 B<Nasty bug fixed in IO::Scalar::write().>
317 Apparently, the offset and the number-of-bytes arguments were,
318 for all practical purposes, I<reversed.> You were okay if
319 you did all your writing with print(), but boy was I<this> a stupid bug!
320 I<Thanks to Richard Jones for finding this one.
321 For you, Rich, a double-length haiku:>
324 typeset by dyslexic man
328 simply not equivalent
331 B<New sysread and syswrite methods for IO::Scalar.>
332 I<Thanks again to Richard Jones for this.>
335 =item Version 1.215 (2000/09/05)
337 Added 'bool' overload to '""' overload, so object always evaluates
338 to true. (Whew. Glad I caught this before it went to CPAN.)
341 =item Version 1.214 (2000/09/03)
343 Evaluating an IO::Scalar in a string context now yields
344 the underlying string.
345 I<Thanks to B. K. Oxley (binkley) for this.>
348 =item Version 1.213 (2000/08/16)
350 Minor documentation fixes.
353 =item Version 1.212 (2000/06/02)
355 Fixed IO::InnerFile incompatibility with Perl5.004.
356 I<Thanks to many folks for reporting this.>
359 =item Version 1.210 (2000/04/17)
361 Added flush() and other no-op methods.
362 I<Thanks to Doru Petrescu for suggesting this.>
365 =item Version 1.209 (2000/03/17)
370 =item Version 1.208 (2000/03/14)
372 Incorporated a number of contributed patches and extensions,
373 mostly related to speed hacks, support for "offset", and
375 I<Thanks to Richard Jones, Doru Petrescu, and many others.>
379 =item Version 1.206 (1999/04/18)
381 Added creation of ./testout when Makefile.PL is run.
384 =item Version 1.205 (1999/01/15)
386 Verified for Perl5.005.
389 =item Version 1.202 (1998/04/18)
391 New IO::WrapTie and IO::AtomicFile added.
401 Added IO::Lines, and made some bug fixes to IO::ScalarArray.
407 No real changes; just upgraded IO::Wrap to have a $VERSION string.
418 =item Primary Maintainer
420 David F. Skoll (F<dfs@roaringpenguin.com>).
422 =item Original Author
424 Eryq (F<eryq@zeegee.com>).
425 President, ZeeGee Software Inc (F<http://www.zeegee.com>).
429 For all their bug reports and patch submissions, the following
430 are officially recognized:
433 B. K. Oxley (binkley)
435 Doug Wilson (for picking up the ball I dropped, and doing tie() right)
440 Go to F<http://www.zeegee.com> for the latest downloads
441 and on-line documentation for this module.
443 Enjoy. Yell if it breaks.