The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Bolts::Blueprint::Literal - A blueprint that points to a literal value

VERSION

version 0.143171

SYNOPSIS

    use Bolts;

    # The usual sugar
    artifact thing1 => 42;
    artifact thing2 => ( value => 42 );
    artifact thing3 => (
        value => [ 'this', 'is', 'an', 'example' ],
    );

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

    my $artifact = Bolts::Artifact->new(
        name      => 'thing',
        blueprint => $meta->locator->acquire('blueprint', 'literal', {
            value => 42,
        },
        scope     => $meta->locator->acquire('scope', '_'),
    );

DESCRIPTION

Provides a blueprint that points to a single value. This is best used for scalars, strings, and numbers, but could be used for references.

Caveat. In the case of references, the same reference is returned every time so the contents of that reference might be modified by anyone that acquires it. This may be desirable in your application, but there's the warning in case it is not.

ROLES

ATTRIBUTES

value

This is the literal value to return when this blueprint is resolved. This can be anything you can assign to a scalar variable, including references to arrays and hash (see the caveat above).

METHODS

builder

Returns the "value".

exists

Always returns true.

implied_scope

This is set. A literal blueprint value acts like a global singleton.

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.