NAME

Bolts::Util - Utilities helpful for use with Bolts

VERSION

version 0.142650

SYNOPSIS

use Bolts::Util qw( locator_for meta_locator_for );

my $loc   = locator_for($bag);
my $thing = $loc->acquire('path', 'to', 'thing');

my $metaloc = meta_locator_for($bag);
my $blueprint = $metaloc->acquire('blueprint', 'factory', {
    class  => 'MyApp::Thing',
    method => 'fetch',
});

DESCRIPTION

This provides some helpful utility methods for use with Bolts.

EXPORTED FUNCTIONS

locator_for

my $loc = locator_for($bag);

Given a bag, it will return a Bolts::Role::Locator for acquiring artifacts from it. If the bag provides it's own locator, the bag will be returned. If it doesn't (e.g., if it's a hash or an array), then a new locator will be built to locate within the bag and returned.

meta_locator_for

my $metaloc = meta_locator_for($bag);

Attempts to find the meta locator for the bag. It returns a Bolts::Role::Locator that is able to return artifacts used to manage a collection of bolts bags and artifacts. If the bag itself does not have such a locator associated with it, one is constructed using the "$Bolts::GLOBAL_FALLBACK_META_LOCATOR" in Bolts class, which is Bolts::Meta::Locator by default.

AUTHOR

Andrew Sterling Hanenkamp <hanenkamp@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Qubling Software LLC.

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