NAME

DBIx::QuickORM::Util - Internal utility functions for DBIx::QuickORM.

DESCRIPTION

A grab-bag of utility functions used internally by DBIx::QuickORM. Nothing is exported by default; request the functions you need by name.

SYNOPSIS

use DBIx::QuickORM::Util qw/load_class column_key/;

my $class = load_class('Some::Class') or die "Error: $@";
my $key   = column_key(@column_names);

EXPORTS

$class_or_false = load_class($class)
$class_or_false = load_class($class, $prefix)

Loads the class, optionally prefixing it with $prefix (a leading + on $class suppresses the prefix). On success it returns the class name. On failure it returns false and $@ is set to the error.

$string = column_key(@column_names)

Returns a stable key string for a set of column names by sorting them and joining with ', '. The same set of names always yields the same key regardless of input order.

@modules = find_modules(@prefixes)

Returns the list of installed modules found under the given namespace prefixes.

$hashref = merge_hash_of_objs($hash_a, $hash_b, \%merge_params)

Merges two hashes whose values may be objects, array refs, hash refs, or plain scalars. Blessed values are merged via their merge method; otherwise the second hash's value wins. \%merge_params is passed through to merge/clone. Returns a new hash ref.

$hashref = clone_hash_of_objs($hash, \%clone_params)

Returns a deep clone of a hash whose values may be objects, array refs, or nested hash refs. Blessed values are cloned via their clone method, receiving \%clone_params.

$string = debug(@args)
debug(@args)

Dumps its arguments using Data::Dumper with sorted, terse output. In non-void context it returns the dump string; in void context it prints the dump.

$params = parse_conflate_args(@args)
$params = parse_conflate_args($proto, @args)

Normalizes the flexible argument forms accepted by the type-conflation interface into a single hash ref. Resolves class, value, and affinity from the supplied prototype and key/value arguments. Croaks unless a value can be determined.

$mask = mask(string => $str, generator => sub { ... }, mask_class => $class)

Build a DBIx::QuickORM::Util::Mask - a lazily-built wrapper that hides a heavy object from dumps and stack traces. See that module for details.

$bool = masked($thing)

True if $thing is a mask.

$obj = unmask($thing)

Returns the wrapped object (building it if needed) for a mask, or $thing unchanged otherwise.

SOURCE

The source code repository for DBIx::QuickORM can be found at https://github.com/exodist/DBIx-QuickORM.

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 https://dev.perl.org/licenses/