Why not adopt me?
This distribution is up for adoption!
If you're interested then please contact the PAUSE module admins via
email.
NAME
Dist::Zilla::Role::Tempdir - Shell Out and collect the result in a DZ plug-in.
VERSION
version 0.01021401
SYNOPSIS
package #
Dist::Zilla::Plugin::FooBar;
use Moose;
with 'Dist::Zilla::Role::Tempdir';
with 'Dist::Zilla::Role::FileInjector';
with 'Dist::Zilla::Role::InstallTool';
sub setup_installer {
my ( $self, $arg ) = @_ ;
my ( @generated_files ) = $self->capture_tempdir(sub{
system( $somecommand );
});
for ( @generated_files ) {
if( $_->{status} eq 'N' && $_->{name} =~ qr/someregex/ ){
$self->add_file( $_->{file});
}
}
}
METHODS
capture_tempdir
Creates a File::Tempdir and dumps the current state of Dist::Zilla's files into it.
Runs the specified code sub chdir
'ed into that tmpdir
, and captures the changed files.
my ( @array ) = $self->capture_tempdir(sub{
});
Response is an array of hash-ref.
{ name => 'file/Name/Here' ,
status => 'O' # O = Original, N = New, M = Modified, D = Deleted
file => Dist::Zilla::Role::File object ( missing if status => 'D'),
}
PRIVATE ATTRIBUTES
_digester
isa => Digest::base,
is => rw,
lazy_build => 1
Used for Digesting the contents of files.
PRIVATE METHODS
_build__digester
returns an instance of Digest::SHA with 512bit hashes.
_digest_for
my $hash = $self->_digest_for( \$content );
Hashes content and returns the result in b64.
AUTHOR
Kent Fredric <kentnl@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Kent Fredric.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.