NAME

Config::Resolver::Utils - Shared utilities for Config::Resolver and plugins

SYNOPSIS

# In your Config::Resolver::Plugin::MyPlugin.pm
package Config::Resolver::Plugin::MyPlugin;

use Config::Resolver::Utils qw(to_boolean is_hash);

if ( is_hash($foo) ) { ... }

my $bool = to_boolean('yes'); # returns 1

DESCRIPTION

This module provides a shared, public set of utility functions for use by Config::Resolver and any module in the Config::Resolver::Plugin::* namespace.

This ensures that all plugins can share a consistent, robust method for type-checking and boolean coercion.

EXPORTABLE SUBROUTINES

None of these are exported by default. You must request them.

to_boolean( $scalar )

Safely coerces a string into a Perl boolean (1 or 0). [cite: 214, 215] Returns undef if the input is undef. [cite: 214]

Valid truthy strings: true, yes, on, 1 Valid falsy strings: false, no, off, 0

Will croak if a defined value is not one of the known strings. [cite: 215]

is_hash( $scalar )

Returns true if the scalar is a HASH reference. [cite: 212]

is_array( $scalar )

Returns true if the scalar is an ARRAY reference. [cite: 212]

AUTHOR

Rob Lauer - <rlauer@treasurersbriefcase.com>