NAME
Bolts::Artifact::Thunk - Simplified artifact implementation
VERSION
version 0.143171
SYNOPSIS
use Bolts;
my $artifact = Bolts::Artifact::Thunk->new(
thunk => sub {
my ($artifact, $bag, %parameters) = @_;
return MyApp::Thing->new(%parameters);
},
);
DESCRIPTION
This provides a greatly simplified implementation of Bolts::Role::Artifact. This skips out on all of the main features of Bolts by just boiling the artifact definition down to the simplest possible form. There are no blueprints, no scope, no injection, just a thunk that does the work.
This is handy for cases where a full-blown artifact implementation is tedious or impossible, particularly when bootstrapping Bolts::Meta::Locator.
It may also be used when you just need a shortcut or optimization. That said, you will probably regret any extensive use of this. (I mean, really, why bother with the Bolt framework if you just short-circuit major bits down to this? You could just implement something simpler and probably faster.)
ROLES
ATTRIBUTES
thunk
This is the code reference used to construct the artifact. It will be called every time the artifact is resolved.
METHODS
get
This is implemented using the execute_method
of Moose::Meta::Attribute::Trait::Native::Code on "thunk".
such_that
Not implemented.
Caution: In the future, this will probably be implemented.
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.