Add built local::lib
[catagits/Gitalist.git] / local-lib5 / man / man3 / IO::Stringy.3pm
1 .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.3
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sh \" Subsection heading
6 .br
7 .if t .Sp
8 .ne 5
9 .PP
10 \fB\\$1\fR
11 .PP
12 ..
13 .de Sp \" Vertical space (when we can't use .PP)
14 .if t .sp .5v
15 .if n .sp
16 ..
17 .de Vb \" Begin verbatim text
18 .ft CW
19 .nf
20 .ne \\$1
21 ..
22 .de Ve \" End verbatim text
23 .ft R
24 .fi
25 ..
26 .\" Set up some character translations and predefined strings.  \*(-- will
27 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28 .\" double quote, and \*(R" will give a right double quote.  | will give a
29 .\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
30 .\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
31 .\" expand to `' in nroff, nothing in troff, for use with C<>.
32 .tr \(*W-|\(bv\*(Tr
33 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34 .ie n \{\
35 .    ds -- \(*W-
36 .    ds PI pi
37 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
39 .    ds L" ""
40 .    ds R" ""
41 .    ds C` ""
42 .    ds C' ""
43 'br\}
44 .el\{\
45 .    ds -- \|\(em\|
46 .    ds PI \(*p
47 .    ds L" ``
48 .    ds R" ''
49 'br\}
50 .\"
51 .\" If the F register is turned on, we'll generate index entries on stderr for
52 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53 .\" entries marked with X<> in POD.  Of course, you'll have to process the
54 .\" output yourself in some meaningful fashion.
55 .if \nF \{\
56 .    de IX
57 .    tm Index:\\$1\t\\n%\t"\\$2"
58 ..
59 .    nr % 0
60 .    rr F
61 .\}
62 .\"
63 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
64 .\" way too many mistakes in technical documents.
65 .hy 0
66 .if n .na
67 .\"
68 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
70 .    \" fudge factors for nroff and troff
71 .if n \{\
72 .    ds #H 0
73 .    ds #V .8m
74 .    ds #F .3m
75 .    ds #[ \f1
76 .    ds #] \fP
77 .\}
78 .if t \{\
79 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80 .    ds #V .6m
81 .    ds #F 0
82 .    ds #[ \&
83 .    ds #] \&
84 .\}
85 .    \" simple accents for nroff and troff
86 .if n \{\
87 .    ds ' \&
88 .    ds ` \&
89 .    ds ^ \&
90 .    ds , \&
91 .    ds ~ ~
92 .    ds /
93 .\}
94 .if t \{\
95 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101 .\}
102 .    \" troff and (daisy-wheel) nroff accents
103 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110 .ds ae a\h'-(\w'a'u*4/10)'e
111 .ds Ae A\h'-(\w'A'u*4/10)'E
112 .    \" corrections for vroff
113 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115 .    \" for low resolution devices (crt and lpr)
116 .if \n(.H>23 .if \n(.V>19 \
117 \{\
118 .    ds : e
119 .    ds 8 ss
120 .    ds o a
121 .    ds d- d\h'-1'\(ga
122 .    ds D- D\h'-1'\(hy
123 .    ds th \o'bp'
124 .    ds Th \o'LP'
125 .    ds ae ae
126 .    ds Ae AE
127 .\}
128 .rm #[ #] #H #V #F C
129 .\" ========================================================================
130 .\"
131 .IX Title "IO::Stringy 3"
132 .TH IO::Stringy 3 "2005-02-10" "perl v5.8.7" "User Contributed Perl Documentation"
133 .SH "NAME"
134 IO\-stringy \- I/O on in\-core objects like strings and arrays
135 .SH "SYNOPSIS"
136 .IX Header "SYNOPSIS"
137 .Vb 7
138 \&    IO::
139 \&    ::AtomicFile   adpO  Write a file which is updated atomically     ERYQ
140 \&    ::Lines        bdpO  I/O handle to read/write to array of lines   ERYQ
141 \&    ::Scalar       RdpO  I/O handle to read/write to a string         ERYQ
142 \&    ::ScalarArray  RdpO  I/O handle to read/write to array of scalars ERYQ
143 \&    ::Wrap         RdpO  Wrap old\-style FHs in standard OO interface  ERYQ
144 \&    ::WrapTie      adpO  Tie your handles & retain full OO interface  ERYQ
145 .Ve
146 .SH "DESCRIPTION"
147 .IX Header "DESCRIPTION"
148 This toolkit primarily provides modules for performing both traditional
149 and object-oriented i/o) on things \fIother\fR than normal filehandles;
150 in particular, IO::Scalar, IO::ScalarArray,
151 and IO::Lines.
152 .PP
153 In the more-traditional IO::Handle front, we
154 have IO::AtomicFile
155 which may be used to painlessly create files which are updated
156 atomically.
157 .PP
158 And in the \*(L"this\-may\-prove\-useful\*(R" corner, we have IO::Wrap,
159 whose exported \fIwraphandle()\fR function will clothe anything that's not
160 a blessed object in an IO::Handle\-like wrapper... so you can just
161 use \s-1OO\s0 syntax and stop worrying about whether your function's caller
162 handed you a string, a globref, or a FileHandle.
163 .SH "WARNINGS"
164 .IX Header "WARNINGS"
165 Perl's \s-1TIEHANDLE\s0 spec was incomplete prior to 5.005_57;
166 it was missing support for \f(CW\*(C`seek()\*(C'\fR, \f(CW\*(C`tell()\*(C'\fR, and \f(CW\*(C`eof()\*(C'\fR.
167 Attempting to use these functions with an IO::Scalar, IO::ScalarArray,
168 IO::Lines, etc. \fBwill not work\fR prior to 5.005_57.
169 None of the relevant methods will be invoked by Perl;
170 and even worse, this kind of bug can lie dormant for a while.
171 If you turn warnings on (via \f(CW$^W\fR or \f(CW\*(C`perl \-w\*(C'\fR), and you see
172 something like this...
173 .PP
174 .Vb 1
175 \&    seek() on unopened file
176 .Ve
177 .PP
178 \&...then you are probably trying to use one of these functions
179 on one of our \s-1IO::\s0 classes with an old Perl.  The remedy is to simply
180 use the \s-1OO\s0 version; e.g.:
181 .PP
182 .Vb 2
183 \&    $SH\->seek(0,0);    ### GOOD: will work on any 5.005
184 \&    seek($SH,0,0);     ### WARNING: will only work on 5.005_57 and beyond
185 .Ve
186 .SH "INSTALLATION"
187 .IX Header "INSTALLATION"
188 .Sh "Requirements"
189 .IX Subsection "Requirements"
190 As of version 2.x, this toolkit requires Perl 5.005 for
191 the IO::Handle subclasses, and 5.005_57 or better is
192 \&\fBstrongly\fR recommended.  See \*(L"\s-1WARNINGS\s0\*(R" for details.
193 .Sh "Directions"
194 .IX Subsection "Directions"
195 Most of you already know the drill...
196 .PP
197 .Vb 4
198 \&    perl Makefile.PL
199 \&    make
200 \&    make test
201 \&    make install
202 .Ve
203 .PP
204 For everyone else out there...
205 if you've never installed Perl code before, or you're trying to use
206 this in an environment where your sysadmin or \s-1ISP\s0 won't let you do
207 interesting things, \fBrelax:\fR since this module contains no binary
208 extensions, you can cheat.  That means copying the directory tree
209 under my \*(L"./lib\*(R" directory into someplace where your script can \*(L"see\*(R"
210 it.  For example, under Linux:
211 .PP
212 .Vb 1
213 \&    cp \-r IO\-stringy\-1.234/lib/* /path/to/my/perl/
214 .Ve
215 .PP
216 Now, in your Perl code, do this:
217 .PP
218 .Vb 2
219 \&    use lib "/path/to/my/perl";
220 \&    use IO::Scalar;                   ### or whatever
221 .Ve
222 .PP
223 Ok, now you've been told.  At this point, anyone who whines about
224 not being given enough information gets an unflattering haiku
225 written about them in the next change log.  I'll do it.
226 Don't think I won't.
227 .SH "VERSION"
228 .IX Header "VERSION"
229 $Id: Stringy.pm,v 1.3 2005/02/10 21:24:05 dfs Exp $
230 .SH "TO DO"
231 .IX Header "TO DO"
232 .IP "(2000/08/02)  Finalize $/ support" 4
233 .IX Item "(2000/08/02)  Finalize $/ support"
234 Graham Barr submitted this patch half a \fIyear\fR ago;
235 Like a moron, I lost his message under a ton of others,
236 and only now have the experimental implementation done.
237 .Sp
238 Will the sudden sensitivity to $/ hose anyone out there?
239 I'm worried, so you have to enable it explicitly in 1.x.
240 It will be on by default in 2.x, though only IO::Scalar
241 has been implemented.
242 .IP "(2001/08/08)  Remove IO::WrapTie from new \s-1IO::\s0 classes" 4
243 .IX Item "(2001/08/08)  Remove IO::WrapTie from new IO:: classes"
244 It's not needed.  Backwards compatibility could be maintained
245 by having \fInew_tie()\fR be identical to \fInew()\fR.  Heck, I'll bet
246 that IO::WrapTie should be reimplemented so the returned
247 object is just like an IO::Scalar in its use of globrefs.
248 .SH "CHANGE LOG"
249 .IX Header "CHANGE LOG"
250 .IP "Version 2.110   (2005/02/10)" 4
251 .IX Item "Version 2.110   (2005/02/10)"
252 Maintainership taken over by \s-1DSKOLL\s0 <dfs@roaringpenguin.com>
253 .Sp
254 Closed the following bugs at
255 https://rt.cpan.org/NoAuth/Bugs.html?Dist=IO\-stringy:
256 .IP "*" 4
257 2208 IO::ScalarArray\->getline does not return undef for \s-1EOF\s0 if undef($/)
258 .IP "*" 4
259 7132 IO\-stringy/Makefile.PL bug \- name should be module name
260 .IP "*" 4
261 11249 IO::Scalar flush shouldn't return undef
262 .IP "*" 4
263 2172 $\e (output record separator) not respected
264 .IP "*" 4
265 8605 \fIIO::InnerFile::seek()\fR should return 1 on success
266 .IP "*" 4
267 4798 *.html in lib/
268 .IP "*" 4
269 4369 Improvement: handling of fixed-size reads in IO::Scalar
270 .Sp
271 (Actually, bug 4369 was closed in Version 2.109)
272 .IP "Version 2.109   (2003/12/21)" 4
273 .IX Item "Version 2.109   (2003/12/21)"
274 IO::Scalar::getline now works with ref to int.
275 \&\fIThanks to Dominique Quatravaux for this patch.\fR
276 .IP "Version 2.108   (2001/08/20)" 4
277 .IX Item "Version 2.108   (2001/08/20)"
278 The terms-of-use have been placed in the distribution file \*(L"\s-1COPYING\s0\*(R".
279 Also, small documentation tweaks were made.
280 .IP "Version 2.105   (2001/08/09)" 4
281 .IX Item "Version 2.105   (2001/08/09)"
282 Added support for various \fIseek()\fR whences to IO::ScalarArray.
283 .Sp
284 Added support for consulting $/ in IO::Scalar and IO::ScalarArray.
285 The old \f(CW\*(C`use_RS()\*(C'\fR is not even an option.
286 Unsupported record separators will cause a \fIcroak()\fR.
287 .Sp
288 Added a lot of regression tests to supoprt the above.
289 .Sp
290 Better on-line docs (hyperlinks to individual functions).
291 .IP "Version 2.103   (2001/08/08)" 4
292 .IX Item "Version 2.103   (2001/08/08)"
293 After sober consideration I have reimplemented \fIIO::Scalar::print()\fR
294 so that it once again always seeks to the end of the string.
295 Benchmarks show the new implementation to be just as fast as
296 Juergen's contributed patch; until someone can convince me otherwise,
297 the current, safer implementation stays.
298 .Sp
299 I thought more about giving IO::Scalar two separate handles,
300 one for reading and one for writing, as suggested by Binkley.
301 His points about what \fItell()\fR and \fIeof()\fR return are, I think,
302 show-stoppers for this feature.  Even the manpages for stdio's \fIfseek()\fR
303 seem to imply a \fIsingle\fR file position indicator, not two.
304 So I think I will take this off the \s-1TO\s0 \s-1DO\s0 list.
305 \&\fBRemedy:\fR you can always have two handles open on the same
306 scalar, one which you only write to, and one which you only read from.
307 That should give the same effect.
308 .IP "Version 2.101   (2001/08/07)" 4
309 .IX Item "Version 2.101   (2001/08/07)"
310 \&\fBAlpha release.\fR
311 This is the initial release of the \*(L"IO::Scalar and friends are
312 now subclasses of IO::Handle\*(R".  I'm flinging it against the wall.
313 Please tell me if the banana sticks.  When it does, the banana
314 will be called 2.2x.
315 .Sp
316 First off, \fImany many thanks to Doug Wilson\fR, who
317 has provided an \fIinvaluable\fR service by patching IO::Scalar
318 and friends so that they (1) inherit from IO::Handle, (2) automatically
319 tie themselves so that the \f(CW\*(C`new()\*(C'\fR objects can be used in native i/o
320 constructs, and (3) doing it so that the whole damn thing passes
321 its regression tests.  As Doug knows, my globref Kung-Fu was not
322 up to the task; he graciously provided the patches.  This has earned
323 him a seat at the Co-Authors table, and the
324 right to have me address him as \fIsensei\fR.
325 .Sp
326 Performance of \fIIO::Scalar::print()\fR has been improved by as much as 2x
327 for lots of little prints, with the cost of forcing those
328 who print-then-seek-then-print to explicitly seek to end-of-string
329 before printing again.
330 \&\fIThanks to Juergen Zeller for this patch.\fR
331 .Sp
332 Added the \s-1COPYING\s0 file, which had been missing from prior versions.
333 \&\fIThanks to Albert Chin-A-Young for pointing this out.\fR
334 .Sp
335 IO::Scalar consults $/ by default (1.x ignored it by default).
336 Yes, I still need to support IO::ScalarArray.
337 .IP "Version 1.221   (2001/08/07)" 4
338 .IX Item "Version 1.221   (2001/08/07)"
339 I threatened in \*(L"\s-1INSTALLATION\s0\*(R" to write an unflattering haiku
340 about anyone who whined that I gave them insufficient information...
341 but it turns out that I left out a crucial direction.  D'\s-1OH\s0!
342 \&\fIThanks to David Beroff for the \*(L"patch\*(R" and the haiku...\fR
343 .Sp
344 .Vb 3
345 \&       Enough info there?
346 \&         Here's unflattering haiku:
347 \&       Forgot the line, "make"!  ;\-)
348 .Ve
349 .IP "Version 1.220   (2001/04/03)" 4
350 .IX Item "Version 1.220   (2001/04/03)"
351 Added untested \s-1SEEK\s0, \s-1TELL\s0, and \s-1EOF\s0 methods to IO::Scalar
352 and IO::ScalarArray to support corresponding functions for
353 tied filehandles: untested, because I'm still running 5.00556
354 and Perl is complaining about \*(L"\fItell()\fR on unopened file\*(R".
355 \&\fIThanks to Graham Barr for the suggestion.\fR
356 .Sp
357 Removed not-fully-blank lines from modules; these were causing
358 lots of POD-related warnings.
359 \&\fIThanks to Nicolas Joly for the suggestion.\fR
360 .IP "Version 1.219   (2001/02/23)" 4
361 .IX Item "Version 1.219   (2001/02/23)"
362 IO::Scalar objects can now be made sensitive to $/ .
363 Pains were taken to keep the fast code fast while adding this feature.
364 \&\fICheers to Graham Barr for submitting his patch;
365 jeers to me for losing his email for 6 months.\fR
366 .IP "Version 1.218   (2001/02/23)" 4
367 .IX Item "Version 1.218   (2001/02/23)"
368 IO::Scalar has a new \fIsysseek()\fR method.
369 \&\fIThanks again to Richard Jones.\fR
370 .Sp
371 New \*(L"\s-1TO\s0 \s-1DO\s0\*(R" section, because people who submit patches/ideas should
372 at least know that they're in the system... and that I won't lose
373 their stuff.  Please read it.
374 .Sp
375 New entries in \*(L"\s-1AUTHOR\s0\*(R".
376 Please read those too.
377 .IP "Version 1.216   (2000/09/28)" 4
378 .IX Item "Version 1.216   (2000/09/28)"
379 \&\fBIO::Scalar and IO::ScalarArray now inherit from IO::Handle.\fR
380 I thought I'd remembered a problem with this ages ago, related to
381 the fact that these \s-1IO::\s0 modules don't have \*(L"real\*(R" filehandles,
382 but the problem apparently isn't surfacing now.
383 If you suddenly encounter Perl warnings during global destruction
384 (especially if you're using tied filehandles), then please let me know!
385 \&\fIThanks to B. K. Oxley (binkley) for this.\fR
386 .Sp
387 \&\fBNasty bug fixed in \f(BIIO::Scalar::write()\fB.\fR
388 Apparently, the offset and the number-of-bytes arguments were,
389 for all practical purposes, \fIreversed.\fR  You were okay if
390 you did all your writing with \fIprint()\fR, but boy was \fIthis\fR a stupid bug!
391 \&\fIThanks to Richard Jones for finding this one.
392 For you, Rich, a double-length haiku:\fR
393 .Sp
394 .Vb 3
395 \&       Newspaper headline
396 \&          typeset by dyslexic man
397 \&       loses urgency
398 .Ve
399 .Sp
400 .Vb 3
401 \&       BABY EATS FISH is
402 \&          simply not equivalent
403 \&       to FISH EATS BABY
404 .Ve
405 .Sp
406 \&\fBNew sysread and syswrite methods for IO::Scalar.\fR
407 \&\fIThanks again to Richard Jones for this.\fR
408 .IP "Version 1.215   (2000/09/05)" 4
409 .IX Item "Version 1.215   (2000/09/05)"
410 Added 'bool' overload to '""' overload, so object always evaluates
411 to true.  (Whew.  Glad I caught this before it went to \s-1CPAN\s0.)
412 .IP "Version 1.214   (2000/09/03)" 4
413 .IX Item "Version 1.214   (2000/09/03)"
414 Evaluating an IO::Scalar in a string context now yields
415 the underlying string.
416 \&\fIThanks to B. K. Oxley (binkley) for this.\fR
417 .IP "Version 1.213   (2000/08/16)" 4
418 .IX Item "Version 1.213   (2000/08/16)"
419 Minor documentation fixes.
420 .IP "Version 1.212   (2000/06/02)" 4
421 .IX Item "Version 1.212   (2000/06/02)"
422 Fixed IO::InnerFile incompatibility with Perl5.004.
423 \&\fIThanks to many folks for reporting this.\fR
424 .IP "Version 1.210   (2000/04/17)" 4
425 .IX Item "Version 1.210   (2000/04/17)"
426 Added \fIflush()\fR and other no-op methods.
427 \&\fIThanks to Doru Petrescu for suggesting this.\fR
428 .IP "Version 1.209   (2000/03/17)" 4
429 .IX Item "Version 1.209   (2000/03/17)"
430 Small bug fixes.
431 .IP "Version 1.208   (2000/03/14)" 4
432 .IX Item "Version 1.208   (2000/03/14)"
433 Incorporated a number of contributed patches and extensions,
434 mostly related to speed hacks, support for \*(L"offset\*(R", and
435 \&\s-1WRITE/CLOSE\s0 methods.
436 \&\fIThanks to Richard Jones, Doru Petrescu, and many others.\fR
437 .IP "Version 1.206   (1999/04/18)" 4
438 .IX Item "Version 1.206   (1999/04/18)"
439 Added creation of ./testout when Makefile.PL is run.
440 .IP "Version 1.205   (1999/01/15)" 4
441 .IX Item "Version 1.205   (1999/01/15)"
442 Verified for Perl5.005.
443 .IP "Version 1.202   (1998/04/18)" 4
444 .IX Item "Version 1.202   (1998/04/18)"
445 New IO::WrapTie and IO::AtomicFile added.
446 .IP "Version 1.110" 4
447 .IX Item "Version 1.110"
448 Added IO::WrapTie.
449 .IP "Version 1.107" 4
450 .IX Item "Version 1.107"
451 Added IO::Lines, and made some bug fixes to IO::ScalarArray.
452 Also, added \fIgetc()\fR.
453 .IP "Version 1.105" 4
454 .IX Item "Version 1.105"
455 No real changes; just upgraded IO::Wrap to have a \f(CW$VERSION\fR string.
456 .SH "AUTHOR"
457 .IX Header "AUTHOR"
458 .IP "Primary Maintainer" 4
459 .IX Item "Primary Maintainer"
460 David F. Skoll (\fIdfs@roaringpenguin.com\fR).
461 .IP "Original Author" 4
462 .IX Item "Original Author"
463 Eryq (\fIeryq@zeegee.com\fR).
464 President, ZeeGee Software Inc (\fIhttp://www.zeegee.com\fR).
465 .IP "Co-Authors" 4
466 .IX Item "Co-Authors"
467 For all their bug reports and patch submissions, the following
468 are officially recognized:
469 .Sp
470 .Vb 4
471 \&     Richard Jones
472 \&     B. K. Oxley (binkley)
473 \&     Doru Petrescu
474 \&     Doug Wilson (for picking up the ball I dropped, and doing tie() right)
475 .Ve
476 .PP
477 Go to \fIhttp://www.zeegee.com\fR for the latest downloads
478 and on-line documentation for this module.
479 .PP
480 Enjoy.  Yell if it breaks.