NAME
Bolts::Meta::Class::Trait::Bag - Metaclass role for Bolts-built bags
VERSION
version 0.143171
DESCRIPTION
While a bag may be any kind of object, this metaclass role on a bag provides some helpful utilities for creating and managing bags.
ATTRIBUTES
artifacts
These are the artifacts that have been added to this bag. It is saved as a hash. You can get the hash of artifacts as a list using list_artifacts
. You add artifacts to this list using "add_artifact".
such_that_isa
This is a Moose::Meta::TypeConstraint to apply to the "isa_type" in Bolts::Artifact of all contained artifacts.
such_that_does
This is a Moose::Meta::TypeConstraint to apply to the "does_type" in Bolts::Artifact of all contained artifacts.
METHODS
is_finished_bag
my $finished = $meta->is_finished_bag;
This is used to determine if a bag's definition has already been performed and completed. At this time, it's just a synonym for "is_immutable" in Class::MOP::Class.
add_artifact
$meta->add_artifact(name => $artifact, {
isa => $isa_type,
does => $does_type,
});
Adds an artifact method to the bag with the given name
. The $artifact
may be an instance of Bolts::Role::Artifact, a code reference to used to define a Bolts::Artifact::Thunk or just another value, which will be wrapped in an anonymous sub and turned into a Bolts::Artifact::Thunk.
The isa
and does
will be applied to the artifact as appropriate.
finish_bag
$meta->finish_bag;
This completes the bag building process and marks the Moose object as immutable. Aft this is called, "is_finished_bag" returns true.
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.