Add the original source packages to maemo, source lenny
[dh-make-perl] / dev / i386 / libio-stringy-perl / io-stringy-2.110 / lib / IO / Stringy.pm
1 package IO::Stringy;
2
3 use vars qw($VERSION);
4 $VERSION = "2.110";
5
6 1;
7 __END__
8
9
10 =head1 NAME
11
12 IO-stringy - I/O on in-core objects like strings and arrays
13
14
15 =head1 SYNOPSIS
16
17     IO::
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
24
25
26 =head1 DESCRIPTION
27
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>.
32
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
36 atomically.
37
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.
43
44
45 =head1 WARNINGS
46
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...
55
56     seek() on unopened file
57
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.:
61
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
64
65
66
67 =head1 INSTALLATION
68
69
70 =head2 Requirements
71
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.
75
76
77 =head2 Directions
78
79 Most of you already know the drill...
80
81     perl Makefile.PL
82     make
83     make test
84     make install
85
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:
93
94     cp -r IO-stringy-1.234/lib/* /path/to/my/perl/
95
96 Now, in your Perl code, do this:
97
98     use lib "/path/to/my/perl";
99     use IO::Scalar;                   ### or whatever
100
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.
104 Don't think I won't.
105
106
107
108 =head1 VERSION
109
110 $Id: Stringy.pm,v 1.3 2005/02/10 21:24:05 dfs Exp $
111
112
113
114 =head1 TO DO
115
116 =over 4
117
118 =item (2000/08/02)  Finalize $/ support
119
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.
123
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.
128
129 =item (2001/08/08)  Remove IO::WrapTie from new IO:: classes
130
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.
135
136
137 =back
138
139
140
141 =head1 CHANGE LOG
142
143 =over 4
144
145
146 =item Version 2.110   (2005/02/10)
147
148 Maintainership taken over by DSKOLL <dfs@roaringpenguin.com>
149
150 Closed the following bugs at
151 https://rt.cpan.org/NoAuth/Bugs.html?Dist=IO-stringy:
152
153 =item
154
155 2208 IO::ScalarArray->getline does not return undef for EOF if undef($/)
156
157 =item
158
159 7132 IO-stringy/Makefile.PL bug - name should be module name
160
161 =item
162
163 11249 IO::Scalar flush shouldn't return undef
164
165 =item
166
167 2172 $\ (output record separator) not respected
168
169 =item
170
171 8605 IO::InnerFile::seek() should return 1 on success
172
173 =item
174
175 4798 *.html in lib/
176
177 =item
178
179 4369 Improvement: handling of fixed-size reads in IO::Scalar
180
181 (Actually, bug 4369 was closed in Version 2.109)
182
183 =item Version 2.109   (2003/12/21)
184
185 IO::Scalar::getline now works with ref to int.
186 I<Thanks to Dominique Quatravaux for this patch.>
187
188
189 =item Version 2.108   (2001/08/20)
190
191 The terms-of-use have been placed in the distribution file "COPYING".
192 Also, small documentation tweaks were made.
193
194
195 =item Version 2.105   (2001/08/09)
196
197 Added support for various seek() whences to IO::ScalarArray.
198
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().
202
203 Added a lot of regression tests to supoprt the above.
204
205 Better on-line docs (hyperlinks to individual functions).
206
207
208 =item Version 2.103   (2001/08/08)
209
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.
215
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.
225
226
227 =item Version 2.101   (2001/08/07)
228
229 B<Alpha release.>
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
233 will be called 2.2x.
234
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>.
244
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.>
250
251 Added the COPYING file, which had been missing from prior versions.
252 I<Thanks to Albert Chin-A-Young for pointing this out.>
253
254 IO::Scalar consults $/ by default (1.x ignored it by default).
255 Yes, I still need to support IO::ScalarArray.
256
257
258 =item Version 1.221   (2001/08/07)
259
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...>
264
265        Enough info there?
266          Here's unflattering haiku:
267        Forgot the line, "make"!  ;-)
268
269
270
271 =item Version 1.220   (2001/04/03)
272
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.>
278
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.>
282
283
284 =item Version 1.219   (2001/02/23)
285
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.>
290
291
292 =item Version 1.218   (2001/02/23)
293
294 IO::Scalar has a new sysseek() method.
295 I<Thanks again to Richard Jones.>
296
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.
300
301 New entries in L<"AUTHOR">.
302 Please read those too.
303
304
305
306 =item Version 1.216   (2000/09/28)
307
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.>
315
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:>
322
323        Newspaper headline
324           typeset by dyslexic man
325        loses urgency
326
327        BABY EATS FISH is
328           simply not equivalent
329        to FISH EATS BABY
330
331 B<New sysread and syswrite methods for IO::Scalar.>
332 I<Thanks again to Richard Jones for this.>
333
334
335 =item Version 1.215   (2000/09/05)
336
337 Added 'bool' overload to '""' overload, so object always evaluates
338 to true.  (Whew.  Glad I caught this before it went to CPAN.)
339
340
341 =item Version 1.214   (2000/09/03)
342
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.>
346
347
348 =item Version 1.213   (2000/08/16)
349
350 Minor documentation fixes.
351
352
353 =item Version 1.212   (2000/06/02)
354
355 Fixed IO::InnerFile incompatibility with Perl5.004.
356 I<Thanks to many folks for reporting this.>
357
358
359 =item Version 1.210   (2000/04/17)
360
361 Added flush() and other no-op methods.
362 I<Thanks to Doru Petrescu for suggesting this.>
363
364
365 =item Version 1.209   (2000/03/17)
366
367 Small bug fixes.
368
369
370 =item Version 1.208   (2000/03/14)
371
372 Incorporated a number of contributed patches and extensions,
373 mostly related to speed hacks, support for "offset", and
374 WRITE/CLOSE methods.
375 I<Thanks to Richard Jones, Doru Petrescu, and many others.>
376
377
378
379 =item Version 1.206   (1999/04/18)
380
381 Added creation of ./testout when Makefile.PL is run.
382
383
384 =item Version 1.205   (1999/01/15)
385
386 Verified for Perl5.005.
387
388
389 =item Version 1.202   (1998/04/18)
390
391 New IO::WrapTie and IO::AtomicFile added.
392
393
394 =item Version 1.110
395
396 Added IO::WrapTie.
397
398
399 =item Version 1.107
400
401 Added IO::Lines, and made some bug fixes to IO::ScalarArray.
402 Also, added getc().
403
404
405 =item Version 1.105
406
407 No real changes; just upgraded IO::Wrap to have a $VERSION string.
408
409 =back
410
411
412
413
414 =head1 AUTHOR
415
416 =over 4
417
418 =item Primary Maintainer
419
420 David F. Skoll (F<dfs@roaringpenguin.com>).
421
422 =item Original Author
423
424 Eryq (F<eryq@zeegee.com>).
425 President, ZeeGee Software Inc (F<http://www.zeegee.com>).
426
427 =item Co-Authors
428
429 For all their bug reports and patch submissions, the following
430 are officially recognized:
431
432      Richard Jones
433      B. K. Oxley (binkley)
434      Doru Petrescu
435      Doug Wilson (for picking up the ball I dropped, and doing tie() right)
436
437
438 =back
439
440 Go to F<http://www.zeegee.com> for the latest downloads
441 and on-line documentation for this module.
442
443 Enjoy.  Yell if it breaks.
444
445
446 =cut