Data::Hopen::Util::Data - general-purpose data-manipulation functions


Nothing is exported by default --- specify :all if you want it all.


Convert a scalar to a Boolean as Perl does, except:

  • Falsy


So false, off, no, empty string, undef, numeric 0, and string '0' are falsy, and all other values are truthy.


Clones a scalar or a reference. Thin wrapper around "dclone" in Storable.


Yet Another routine for dedenting multiline strings. Removes the leading horizontal whitespace on the first nonblank line from all lines. If the first argument is a reference, also trims for use in multiline q()/qq(). Usage:

    dedent " some\n multiline string";
    dedent [], q(
        very indented
    );      # [] (or any ref) means do the extra trimming.

The extra trimming includes:

  • Removing the initial \n, if any; and

  • Removing trailing horizontal whitespace between the last \n and the end of the string.


Returns a list of key-value pairs extracted from a given hashref. Usage:

    my %forwarded_opts = forward_opts(\%original_opts, [option hashref,]
                                        'name'[, 'name2'...]);

If the option hashref is given, the following can be provided:


If truthy, lower-case the key names in the output


If present, add - to the beginning of each name in the output. This is useful with Getargs::Mixed.