Convert-Scalar
view release on metacpan or search on metacpan
- some functions now return the modified scalar, enabling a more
"functional" style, e.g. return utf2, join "",...;
0.03 Sun Sep 3 04:55:53 CEST 2000
- added "utf8/utf8_on/utf8_off" functions.
- added grow as an interface to sv_grow.
- added "tainted" and fixed taint/untaint to use the published
interface.
0.02 Sat Jul 15 22:37:36 CEST 2000
- added missing functions weaken and unmagic to EXPORT_OK.
This happens when you upload too quickly :*]
0.01 Sat Jul 15 20:15:47 CEST 2000
- original version; leftover "garbage" from the PApp module
readonly_on scalar
Sets the readonly flag on the scalar.
readonly_off scalar
Clears the readonly flag on the scalar.
unmagic scalar, type
Remove the specified magic from the scalar (DANGEROUS!).
weaken scalar
Weaken a reference. (See also WeakRef).
taint scalar
Taint the scalar.
tainted scalar
returns true when the scalar is tainted, false otherwise.
untaint scalar
Remove the tainted flag from the specified scalar.
refcnt scalar[, newrefcnt]
Returns the current reference count of the given scalar and
optionally sets it to the given reference count.
refcnt_inc scalar
Increments the reference count of the given scalar inplace.
refcnt_dec scalar
Decrements the reference count of the given scalar inplace. Use
"weaken" instead if you understand what this function is fore.
Better yet: don't use this module in this case.
refcnt_rv scalar[, newrefcnt]
Works like "refcnt", but dereferences the given reference first.
This is useful to find the reference count of arrays or hashes,
which cannot be passed directly. Remember that taking a reference of
some object increases it's reference count, so the reference count
used by the *_rv-functions tend to be one higher.
refcnt_inc_rv scalar
=over 4
=cut
package Convert::Scalar;
BEGIN {
$VERSION = 1.12;
@ISA = qw(Exporter);
@EXPORT_OK = qw(readonly readonly_on readonly_off weaken unmagic len grow extend extend_read readall writeall);
%EXPORT_TAGS = (
taint => [qw(taint untaint tainted)],
utf8 => [qw(utf8 utf8_on utf8_off utf8_valid utf8_upgrade utf8_downgrade utf8_encode utf8_decode utf8_length)],
refcnt => [qw(refcnt refcnt_inc refcnt_dec refcnt_rv refcnt_inc_rv refcnt_dec_rv)],
ok => [qw(ok uok rok pok nok niok)],
);
require Exporter;
Exporter::export_ok_tags(keys %EXPORT_TAGS);
Sets the readonly flag on the scalar.
=item readonly_off scalar
Clears the readonly flag on the scalar.
=item unmagic scalar, type
Remove the specified magic from the scalar (DANGEROUS!).
=item weaken scalar
Weaken a reference. (See also L<WeakRef>).
=item taint scalar
Taint the scalar.
=item tainted scalar
returns true when the scalar is tainted, false otherwise.
Returns the current reference count of the given scalar and optionally sets it to
the given reference count.
=item refcnt_inc scalar
Increments the reference count of the given scalar inplace.
=item refcnt_dec scalar
Decrements the reference count of the given scalar inplace. Use C<weaken>
instead if you understand what this function is fore. Better yet: don't
use this module in this case.
=item refcnt_rv scalar[, newrefcnt]
Works like C<refcnt>, but dereferences the given reference first. This is
useful to find the reference count of arrays or hashes, which cannot be
passed directly. Remember that taking a reference of some object increases
it's reference count, so the reference count used by the C<*_rv>-functions
tend to be one higher.
readonly_off (SV *scalar)
CODE:
SvREADONLY_off (scalar);
void
unmagic (SV *scalar, char type)
CODE:
sv_unmagic (scalar, type);
void
weaken (SV *scalar)
CODE:
sv_rvweaken (scalar);
void
taint (SV *scalar)
CODE:
SvTAINTED_on (scalar);
bool
tainted (SV *scalar)
CODE:
RETVAL = !!SvTAINTED (scalar);
( run in 0.272 second using v1.01-cache-2.11-cpan-65fba6d93b7 )