NAME

Bolts::Blueprint::Given - Used to pass parameters from the user during acquisition into the injector

VERSION

version 0.143170

SYNOPSIS

use Bolts;

# Using the usual sugar...
artifact thing => (
    ...
    parameters => {
        thing => option { # uses blueprint, given
            isa      => 'Str',
            required => 1,
        },
    },
);

# Or directly...
my $meta = Bolts::Bag->start_bag;

my $artifact = Bolts::Artifact->new(
    ...
    injectors => [
        $meta->locator->acquire('injector', 'parameter_name', {
            key       => 'thing',
            blueprint => $meta->locator->acquire('blueprint', 'given', {
                required => 1,
            }),
            isa       => 'Str',
        }),
    ],
);

DESCRIPTION

This takes parameters passed in during acquisition and passes them on to the injector. It is only useful for handling parameters passed during acquisition. It is a no-op if used as a regular artifact blueprint.

ROLES

ATTRIBUTES

required

The blueprint will complain if this flag is set, but the keyed parameter is not found in those passed during acquisition.

METHODS

builder

This takes finds the parameter matching the injector key in the passed in parameters and returns it.

exists

Returns true when the parameters contains the named key and when "required" is set to true.

implied_scope

This is set, but doesn't really matter since scope does not matter during injection.

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.