NAME

Getopt::Yath::Util - Utility functions for Getopt::Yath

DESCRIPTION

Collection of utility functions for Getopt::Yath.

SYNOPSIS

use Getopt::Yath qw{
    fqmod
    mod2file
    decode_json
    encode_json
    encode_json_file
    decode_json_file
};

EXPORTS

$module = fqmod($name, $prefix)
$module = fqmod($name, $prefix, no_require => $BOOL)
$module = fqmod($name, \@prefixes)
$module = fqmod($name, \@prefixes, no_require => $BOOL)

Look for a module named "${prefix}::${name}" for each provided prefix. Will returns the first one it finds that can be loaded. If no_require => 1 is provided it will not attempt to load any and will usually just return using the first prefix.

If $name starts with a '+' then it is assumed to already be a fully qualified module name and the module name will be returned with the '+' removed.

If $name starts with one of the prefixes, no prefix will be added and the original $name will be returned.

This function will throw an exception if it cannot find a valid module.

$file = mod2file($module)

Convert a module name to a filename.

$data = decode_json($json)

Decode a json string to perl data.

$json = encode_json($data)

Encode perl data into a json string using only ascii characters.

$file = encode_json_file($data)

Encode the data to a json file. A new tempfile filename is returend.

$data = decode_json_file($path)

Decode json from specified filename.

SOURCE

The source code repository for Getopt-Yath can be found at http://github.com/Test-More/Getopt-Yath/.

MAINTAINERS

Chad Granum <exodist@cpan.org>

AUTHORS

Chad Granum <exodist@cpan.org>

COPYRIGHT

Copyright Chad Granum <exodist7@gmail.com>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://dev.perl.org/licenses/