NAME

Bolts::Role::Opaque - Make a bag/artifact opaque to acquisition

VERSION

version 0.143171

SYNOPSIS

package MyApp::Secrets;
use Moose;

with 'Bolts::Role::Opaque';

sub foo { "secret" }

package MyApp;
use Bolts;

artifact 'secrets' => (
    class => 'MyApp::Secrets',
);

my $bag = MyApp->new;
my $secrets = $bag->acquire('secrets'); # OK!
my $foo     = $secrets->foo;            # OK!

# NO NO NO! Croaks.
my $foo_direct = $bag->acquire('secrets', 'foo'); # NO!

DESCRIPTION

Marks an artifact/bag so that the item cannot be reached via the acquire method.

Why? I don't know. It seemed like a good idea.

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.