Git::PurePerl::Walker::Role::HasRepo - An entity that has a repo
version 0.004000
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.
MooseX::Clone
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 );
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 separate, 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 arguments.
This instead is simple:
my $thing = Thing->new( %args ); my ( @foos ) = map { $thing->for_repository( $_ ) } @repos;
And now all @foos can be mangled independently.
@foos
MooseX::Clone->clone( %params )
Kent Fredric <kentnl@cpan.org>
This software is copyright (c) 2014 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.
To install Git::PurePerl::Walker, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Git::PurePerl::Walker
CPAN shell
perl -MCPAN -e shell install Git::PurePerl::Walker
For more information on module installation, please visit the detailed CPAN module installation guide.