The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Bolts::Role::Artifact - The role implemented by resolved artifacts

VERSION

version 0.143171

DESCRIPTION

An artifact can be any kind of object. However, during acquistion, the resolution phase is only performed on objects implementing this role. Resolution allows the artifact to make decisions about how to construct, inject dependencies, and cache the object.

See Bolts::Artifact for the reference implementation of this method. Bolts::Artifact::Thunk provides a second, simpler, and less featureful implementation.

REQUIRED METHODS

get

    my $resolved_artifact = $artifact->get($bag, %options);

This method is called during resolution to all the artifact to decide how to resolve the real artifact.

such_that

    $artifact->such_that(
        isa  => $type,
        does => $type,
    );

This applies type constraints to the resolved object. These are invariants that should be applied as soon as the artifact is able to do so.

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.