The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

DTA::CAB::Utils - generic DTA::CAB utilities

SYNOPSIS

use DTA::CAB::Utils;

##========================================================================
## Functions: XML strings

$safe = xml_safe_string($str);

##========================================================================
## Functions: Deep recoding

$decoded = deep_decode($encoding,$thingy,%options);
$encoded = deep_encode($encoding,$thingy,%opts);
$recoded = deep_recode($from,$to,$thingy, %opts);
$upgraded = deep_utf8_upgrade($thingy);

##========================================================================
## Functions: abstract data path value

$val_or_undef = path_value($obj,@path);

DESCRIPTION

Globals

Variable: @EXPORT

No symbols are exported by default.

Variable: %EXPORT_TAGS

Supports the following export tags:

:xml     ##-- xml_safe_string
:data    ##-- path_value
:encode  ##-- deep_encode, deep_decode, deep_recode, deep_utf8_upgrade

Functions: XML strings

xml_safe_string
$safe = xml_safe_string($str);

Returns a string $safe similar to the argument $str which can function as an element or attribute name in XML.

Functions: Deep recoding

deep_decode
$decoded = deep_decode($encoding,$thingy,%options);

Perform recursive string decoding on all scalars in $thingy. Does NOT check for cyclic references.

%options:

force    => $bool,   ##-- decode even if the utf8 flag is set
skipvals => \@vals,  ##-- don't decode (or recurse into)  $val (overrides $force)
skiprefs => \@refs,  ##-- don't decode (or recurse into) $$ref (overrides $force)
skippkgs => \@pkgs,  ##-- don't decode (or recurse into) anything of package $pkg (overrides $force)
deep_encode
$encoded = deep_encode($encoding,$thingy,%opts);

Perform recursive string encoding on all scalars in $thingy. Does NOT check for cyclic references.

%opts:

force => $bool,            ##-- encode even if the utf8 flag is NOT set
skipvals => \@vals,        ##-- don't encode (or recurse into)  $val (overrides $force)
skiprefs => \@refs,        ##-- don't encode (or recurse into) $$ref (overrides $force)
skippkgs => \@pkgs,        ##-- don't encode (or recurse into) anything of package $pkg (overrides $force)
deep_recode
$recoded = deep_recode($from,$to,$thingy, %opts);

Wrapper for:

deep_encode($to,deep_decode($from,$thingy,%opts),%opts);
deep_utf8_upgrade
$upgraded = deep_utf8_upgrade($thingy);

Perform recursive utf_uprade() on all scalars in $thingy. Does NOT check for cyclic references.

Functions: abstract data path value

path_value
$val_or_undef = path_value($obj,@path);

Gets the value of the data path @path in $obj.

AUTHOR

Bryan Jurish <moocow@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2009-2019 by Bryan Jurish

This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.24.1 or, at your option, any later version of Perl 5 you may have available.