| Dist-Zilla documentation | Contained in the Dist-Zilla distribution. |
Dist::Zilla::Plugin::FinderCode - a callback-based FileFinder plugin
version 4.200008
Ricardo SIGNES <rjbs@cpan.org>
This software is copyright (c) 2011 by Ricardo SIGNES.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
| Dist-Zilla documentation | Contained in the Dist-Zilla distribution. |
package Dist::Zilla::Plugin::FinderCode; BEGIN { $Dist::Zilla::Plugin::FinderCode::VERSION = '4.200008'; } use Moose; with 'Dist::Zilla::Role::FileFinder'; # ABSTRACT: a callback-based FileFinder plugin use Moose::Autobox; use Moose::Util::TypeConstraints; use namespace::autoclean; has code => ( is => 'ro', isa => 'CodeRef', required => 1, ); has style => ( is => 'ro', isa => enum([ qw(grep list) ]), required => 1, ); sub find_files { my ($self) = @_; my $method = '_find_via_' . $self->style; $self->$method; } sub _find_via_grep { my ($self) = @_; my @files = grep { $self->code->($_, $self) } $self->zilla->files->flatten; return \@files; } sub _find_via_list { my ($self) = @_; my $code = $self->code; $self->$code; } 1; __END__