Why not adopt me?
NAME
Git::PurePerl::Walker::Role::HasRepo - An entity that has a repo
VERSION
version 0.001000
DESCRIPTION
This is a composition role consumed by other roles to provide them with a private repo property.
This role also folds in MooseX::Clone
and provides the 'for_repository' method which sets the repo property.
package Foo {
use Moose;
with 'Git::PurePerl::Walker::Role::HasRepo';
__PACKAGE__->meta->make_immutable;
}
my $factory = Foo->new( %args );
my $instance = $factory->for_repository( $Git_PurePerl_Repo );
METHODS
for_repository
Construct an entity for a given repository.
This internally calls MooseX::Clone
on the current object, passing the _repo field to its constructor, producing a seperate, disconnected object to work with.
The rationale behind this is simple: Its very likely users will want one set of settings for a consuming class, but they'll want to use those same settings with multiple repositories.
And as each repository will need to maintain its own state for traversal, they have to normally manually construct an object for each repository, manually disconnecting the constructor arugments.
This instead is simple:
my $thing = Thing->new( %args );
my ( @foos ) = map { $thing->for_repository( $_ ) } @repos;
And now all @foos
can be mangled independently.
INHERITED METHODS
clone
MooseX::Clone->clone( %params )
PRIVATE ATTRIBUTES
_repo
PRIVATE ATTRIBUTE GENERATED METHODS
_repo
CONSUMED ROLES
MooseX::Clone
AUTHOR
Kent Fredric <kentnl@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Kent Fredric <kentnl@cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.