Dist-Zilla-Role-Tempdir
view release on metacpan or search on metacpan
- POD reorganised for consistency.
[Misc]
- Improve source side POD to reduce build side whitespace.
[Tests]
- update ReportPrereqs test
1.001000 2014-07-29T09:21:17Z
[00 Major]
- ::Dir has new 'keepalive' method to mark/unmark scratch dirs for destruction.
- ::Dir nas new 'keepalive_fail' method to trigger a croak, keep the temporary directory, and tell the user where to
find it.
- ::Dir::run_in() and thus, ::Role::Tempdir::capture_tempdir(), now pass the Dir object itself as $_[0] for easy
access.
- ::Dir now generates tempdirs with the prefix "DZ_R_Tempdir_" for easy cleanup if tempdirs are left around.
- ::Dir now supports property '_tempdir_owner' which will be normalised and included in the tempdir prefix if
specified.
- ::Role::Tempdir::capture_tempdir) now automatically passes the name of the consuming plugin as "_tempdir_owner",
giving consuming plugins clear tempdir locations when things fail.
1.000001 2014-07-29T06:22:12Z
lib/Dist/Zilla/Tempdir/Dir.pm view on Meta::CPAN
sub keepalive {
my $nargs = my ( $self, $keep ) = @_;
my $path = $self->_tempdir;
if ( $nargs < 2 ) {
return $path;
}
if ($keep) {
$path->[Path::Tiny::TEMP]->unlink_on_destroy(0);
lib/Dist/Zilla/Tempdir/Dir.pm view on Meta::CPAN
sub keepalive_fail {
my ( $self, $message ) = @_;
if ( not $message ) {
$message = q[];
}
else {
$message .= qq[\n];
}
$message .= q[Role::Tempdir's scratch directory preserved at ] . $self->keepalive(1);
croak $message;
}
no Moose;
__PACKAGE__->meta->make_immutable;
1;
__END__
lib/Dist/Zilla/Tempdir/Dir.pm view on Meta::CPAN
and information ready for C<< ->files >>
=head2 C<run_in>
my $rval = $dir->run_in(sub {
return 1;
});
Enter the temporary directory and run the passed code block, which is assumed to be creating/modifying/deleting files.
=head2 C<keepalive>
Utility method: Marks the temporary directory for preservation.
$dir->keepalive() # simply returns the path to the tempdir
$dir->keepalive(1) # mark for retention
$dir->keepalive(0) # mark for erasure
This is mostly an insane glue layer for
$dir->_tempdir->[Path::Tiny::TEMP]->unlink_on_destroy($x)
Except the insanity of poking too many internal guts is well encapsulated.
=head2 C<keepalive_fail>
A utility method to invoke a croak (heh) that preserves the scratch directory, and tells
the croak recipient where to find it.
$dir->keepalive_fail();
$dir->keepalive_fail("Some Diagnostic Reason");
=head1 AUTHOR
Kent Fredric <kentnl@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2017 by Kent Fredric <kentfredric@gmail.com>.
This is free software; you can redistribute it and/or modify it under
( run in 0.399 second using v1.01-cache-2.11-cpan-39bf76dae61 )