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.1 by root, Thu Sep 27 18:32:22 2001 UTC vs.
Revision 1.8 by root, Sat Apr 24 06:38:08 2004 UTC

12representation or state of a perl scalar. All of these work in-place, that 12representation or state of a perl scalar. All of these work in-place, that
13is, they modify their scalar argument. No functions are exported by default. 13is, they modify their scalar argument. No functions are exported by default.
14 14
15The following export tags exist: 15The following export tags exist:
16 16
17 :utf8 all functions with utf8 in their names 17 :utf8 all functions with utf8 in their name
18 :taint all functions with taint in their names 18 :taint all functions with taint in their name
19 :refcnt all functions with refcnt in their name
20 :ok all *ok-functions.
19 21
20=over 4 22=over 4
21 23
22=cut 24=cut
23 25
24package Convert::Scalar; 26package Convert::Scalar;
25 27
26BEGIN { 28BEGIN {
27 $VERSION = 0.06; 29 $VERSION = '1.0';
28 @ISA = qw(Exporter); 30 @ISA = qw(Exporter);
29 @EXPORT_OK = qw(weaken unmagic grow); 31 @EXPORT_OK = qw(weaken unmagic grow);
30 %EXPORT_TAGS = ( 32 %EXPORT_TAGS = (
31 taint => [qw(taint untaint tainted)], 33 taint => [qw(taint untaint tainted)],
32 utf8 => [qw(utf8 utf8_on utf8_off utf8_valid utf8_upgrade utf8_downgrade utf8_encode utf8_decode utf8_length)], 34 utf8 => [qw(utf8 utf8_on utf8_off utf8_valid utf8_upgrade utf8_downgrade utf8_encode utf8_decode utf8_length)],
35 refcnt => [qw(refcnt refcnt_inc refcnt_dec refcnt_rv refcnt_inc_rv refcnt_dec_rv)],
36 ok => [qw(ok uok rok pok nok niok)],
33 ); 37 );
34 38
35 require Exporter; 39 require Exporter;
36 Exporter::export_ok_tags(keys %EXPORT_TAGS); 40 Exporter::export_ok_tags(keys %EXPORT_TAGS);
37 41
90 94
91Returns the number of characters in the string, counting wide UTF8 95Returns the number of characters in the string, counting wide UTF8
92characters as a single character, independent of wether the scalar is 96characters as a single character, independent of wether the scalar is
93marked as containing bytes or mulitbyte characters. 97marked as containing bytes or mulitbyte characters.
94 98
95=item unmagic scalar 99=item unmagic scalar, type
96 100
97Removes magic from the scalar. 101Remove the specified magic from the scalar (DANGEROUS!).
98 102
99=item weaken scalar 103=item weaken scalar
100 104
101Weaken a reference. (See also L<WeakRef>). 105Weaken a reference. (See also L<WeakRef>).
102 106
106 110
107=item tainted scalar 111=item tainted scalar
108 112
109returns true when the scalar is tainted, false otherwise. 113returns true when the scalar is tainted, false otherwise.
110 114
111=item untaint scalar, type 115=item untaint scalar
112 116
113Remove the specified magic from the scalar 117Remove the tainted flag from the specified scalar.
114(DANGEROUS!), L<perlguts>. L<Untaint>, for a similar but different
115interface.
116 118
117=item grow scalar, newlen 119=item grow scalar, newlen
118 120
119Sets the memory area used for the scalar to the given length, if the 121Sets the memory area used for the scalar to the given length, if the
120current length is less than the new value. This does not affect the 122current length is less than the new value. This does not affect the
121contents of the scalar, but is only useful to "pre-allocate" memory space 123contents of the scalar, but is only useful to "pre-allocate" memory space
122if you know the scalar will grow. The return value is the modified scalar 124if you know the scalar will grow. The return value is the modified scalar
123(the scalar is modified in-place). 125(the scalar is modified in-place).
126
127=item refcnt scalar[, newrefcnt]
128
129Returns the current reference count of the given scalar and optionally sets it to
130the given reference count.
131
132=item refcnt_inc scalar
133
134Increments the reference count of the given scalar inplace.
135
136=item refcnt_dec scalar
137
138Decrements the reference count of the given scalar inplace. Use C<weaken>
139instead if you understand what this function is fore. Better yet: don't
140use this module in this case.
141
142=item refcnt_rv scalar[, newrefcnt]
143
144Works like C<refcnt>, but dereferences the given reference first. This is
145useful to find the reference count of arrays or hashes, which cnanot be
146passed directly. Remember that taking a reference of some object increases
147it's reference count, so the reference count used by the C<*_rv>-functions
148tend to be one higher.
149
150=item refcnt_inc_rv scalar
151
152Works like C<refcnt_inc>, but dereferences the given reference first.
153
154=item refcnt_dec_rv scalar
155
156Works like C<refcnt_dec>, but dereferences the given reference first.
157
158=item ok scalar
159
160=item uok scalar
161
162=item rok scalar
163
164=item pok scalar
165
166=item nok scalar
167
168=item niok scalar
169
170Calls SvOK, SvUOK, SvROK, SvPOK, SvNOK or SvNIOK on the given scalar,
171respectively.
124 172
125=cut 173=cut
126 174
1271; 1751;
128 176

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines