… | |
… | |
12 | representation or state of a perl scalar. All of these work in-place, that |
12 | representation or state of a perl scalar. All of these work in-place, that |
13 | is, they modify their scalar argument. No functions are exported by default. |
13 | is, they modify their scalar argument. No functions are exported by default. |
14 | |
14 | |
15 | The following export tags exist: |
15 | The 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 | |
24 | package Convert::Scalar; |
26 | package Convert::Scalar; |
25 | |
27 | |
26 | BEGIN { |
28 | BEGIN { |
27 | $VERSION = 0.06; |
29 | $VERSION = 0.1; |
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 | |
… | |
… | |
120 | current length is less than the new value. This does not affect the |
124 | current length is less than the new value. This does not affect the |
121 | contents of the scalar, but is only useful to "pre-allocate" memory space |
125 | contents of the scalar, but is only useful to "pre-allocate" memory space |
122 | if you know the scalar will grow. The return value is the modified scalar |
126 | if you know the scalar will grow. The return value is the modified scalar |
123 | (the scalar is modified in-place). |
127 | (the scalar is modified in-place). |
124 | |
128 | |
|
|
129 | =item refcnt scalar[, newrefcnt] |
|
|
130 | |
|
|
131 | Returns the current reference count of the given scalar and optionally sets it to |
|
|
132 | the given reference count. |
|
|
133 | |
|
|
134 | =item refcnt_inc scalar |
|
|
135 | |
|
|
136 | Increments the reference count of the given scalar inplace. |
|
|
137 | |
|
|
138 | =item refcnt_dec scalar |
|
|
139 | |
|
|
140 | Decrements the reference count of the given scalar inplace. Use C<weaken> |
|
|
141 | instead if you understand what this function is fore. Better yet: don't |
|
|
142 | use this module in this case. |
|
|
143 | |
|
|
144 | =item refcnt_rv scalar[, newrefcnt] |
|
|
145 | |
|
|
146 | Works like C<refcnt>, but dereferences the given reference first. Remember |
|
|
147 | that taking a reference of some object increases it's reference count, so |
|
|
148 | the reference count used by the C<*_rv>-funtions tend to be one higher. |
|
|
149 | |
|
|
150 | =item refcnt_inc_rv scalar |
|
|
151 | |
|
|
152 | Works like C<refcnt_inc>, but dereferences the given reference first. |
|
|
153 | |
|
|
154 | =item refcnt_dec_rv scalar |
|
|
155 | |
|
|
156 | Works 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 | |
|
|
170 | Calls SvOK, SvUOK, SvROK, SvPOK, SvNOK or SvNIOK on the given scalar, |
|
|
171 | respectively. |
|
|
172 | |
125 | =cut |
173 | =cut |
126 | |
174 | |
127 | 1; |
175 | 1; |
128 | |
176 | |
129 | =back |
177 | =back |