… | |
… | |
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 |
19 | |
20 | |
20 | =over 4 |
21 | =over 4 |
21 | |
22 | |
22 | =cut |
23 | =cut |
23 | |
24 | |
24 | package Convert::Scalar; |
25 | package Convert::Scalar; |
25 | |
26 | |
26 | BEGIN { |
27 | BEGIN { |
27 | $VERSION = 0.06; |
28 | $VERSION = 0.07; |
28 | @ISA = qw(Exporter); |
29 | @ISA = qw(Exporter); |
29 | @EXPORT_OK = qw(weaken unmagic grow); |
30 | @EXPORT_OK = qw(weaken unmagic grow); |
30 | %EXPORT_TAGS = ( |
31 | %EXPORT_TAGS = ( |
31 | taint => [qw(taint untaint tainted)], |
32 | 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)], |
33 | utf8 => [qw(utf8 utf8_on utf8_off utf8_valid utf8_upgrade utf8_downgrade utf8_encode utf8_decode utf8_length)], |
|
|
34 | refcnt => [qw(refcnt refcnt_inc refcnt_dec refcnt_rv refcnt_inc_rv refcnt_dec_rv)], |
33 | ); |
35 | ); |
34 | |
36 | |
35 | require Exporter; |
37 | require Exporter; |
36 | Exporter::export_ok_tags(keys %EXPORT_TAGS); |
38 | Exporter::export_ok_tags(keys %EXPORT_TAGS); |
37 | |
39 | |
… | |
… | |
120 | current length is less than the new value. This does not affect the |
122 | 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 |
123 | 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 |
124 | if 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). |
124 | |
126 | |
|
|
127 | =item refcnt scalar[, newrefcnt] |
|
|
128 | |
|
|
129 | Returns the current refference count of the given scalar and optionally sets it to |
|
|
130 | the given reference count. |
|
|
131 | |
|
|
132 | =item refcnt_inc scalar |
|
|
133 | |
|
|
134 | Increments the reference count of the given scalar inplace. |
|
|
135 | |
|
|
136 | =item refcnt_dec scalar |
|
|
137 | |
|
|
138 | Decrements the reference count of the given scalar inplace. Use C<weaken> |
|
|
139 | instead if you understand what this function is fore. Better yet: don't |
|
|
140 | use this module in this case. |
|
|
141 | |
|
|
142 | =item refcnt_rv scalar[, newrefcnt] |
|
|
143 | |
|
|
144 | Works like C<refcnt>, but dereferences the given reference first. Remember |
|
|
145 | that taking a reference of some object increases it's reference count, so |
|
|
146 | the reference count used by the C<*_rv>-funtions tend to be one higher. |
|
|
147 | |
|
|
148 | =item refcnt_inc_rv scalar |
|
|
149 | |
|
|
150 | Works like C<refcnt_inc>, but dereferences the given reference first. |
|
|
151 | |
|
|
152 | =item refcnt_dec_rv scalar |
|
|
153 | |
|
|
154 | Works like C<refcnt_dec>, but dereferences the given reference first. |
|
|
155 | |
125 | =cut |
156 | =cut |
126 | |
157 | |
127 | 1; |
158 | 1; |
128 | |
159 | |
129 | =back |
160 | =back |