ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Convert-Scalar/Scalar.pm
(Generate patch)

Comparing Convert-Scalar/Scalar.pm (file contents):
Revision 1.17 by root, Tue Aug 15 07:29:06 2017 UTC vs.
Revision 1.18 by root, Wed Jul 25 22:34:28 2018 UTC

91removed in future versions). 91removed in future versions).
92 92
93=item utf8_length scalar 93=item utf8_length scalar
94 94
95Returns the number of characters in the string, counting wide UTF8 95Returns the number of characters in the string, counting wide UTF8
96characters as a single character, independent of wether the scalar is 96characters as a single character, independent of whether the scalar is
97marked as containing bytes or mulitbyte characters. 97marked as containing bytes or mulitbyte characters.
98 98
99=item $old = readonly scalar[, $new] 99=item $old = readonly scalar[, $new]
100 100
101Returns whether the scalar is currently readonly, and sets or clears the 101Returns whether the scalar is currently readonly, and sets or clears the
160=item nread = extend_read fh, scalar, addlen=64 160=item nread = extend_read fh, scalar, addlen=64
161 161
162Calls C<extend scalar, addlen> to ensure some space is available, then 162Calls C<extend scalar, addlen> to ensure some space is available, then
163do the equivalent of C<sysread> to the end, to try to fill the extra 163do the equivalent of C<sysread> to the end, to try to fill the extra
164space. Returns how many bytes have been read, C<0> on EOF or undef> on 164space. Returns how many bytes have been read, C<0> on EOF or undef> on
165eror, just like C<sysread>. 165error, just like C<sysread>.
166 166
167This function is useful to implement many protocols where you read some 167This function is useful to implement many protocols where you read some
168data, see if it is enough to decode, and if not, read some more, where the 168data, see if it is enough to decode, and if not, read some more, where the
169naive or easy way of doing this would result in bad performance. 169naive or easy way of doing this would result in bad performance.
170 170
173Tries to read C<length> bytes into C<scalar>. Unlike C<read> or 173Tries to read C<length> bytes into C<scalar>. Unlike C<read> or
174C<sysread>, it will try to read more bytes if not all bytes could be read 174C<sysread>, it will try to read more bytes if not all bytes could be read
175in one go (this is often called C<xread> in C). 175in one go (this is often called C<xread> in C).
176 176
177Returns the total nunmber of bytes read (normally C<length>, unless an 177Returns the total nunmber of bytes read (normally C<length>, unless an
178error or EOF occured), C<0> on EOF and C<undef> on errors. 178error or EOF occurred), C<0> on EOF and C<undef> on errors.
179 179
180=item nwritten = write_all fh, scalar 180=item nwritten = write_all fh, scalar
181 181
182Like C<readall>, but for writes - the equivalent of the C<xwrite> function 182Like C<readall>, but for writes - the equivalent of the C<xwrite> function
183often seen in C. 183often seen in C.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines