Dist::Zilla::Tempdir::Dir - A temporary directory with a collection of item states
version 1.001003
my $dir = Dist::Zilla::Tempdir::Dir->new(); $dir->add_file( $zilla_file ); $dir->run_in(sub { }); $dir->update_input_files; $dir->update_disk_files; my @file_states = $dir->files();
files
Returns a list of Dist::Zilla::Tempdir::Item
Dist::Zilla::Tempdir::Item
add_file
$dir->add_file( $dzil_file );
Adds $dzil_file to the named temporary directory, written out to disk, and records it internally as an "original" file.
$dzil_file
update_input_file
$dir->update_input_file( $dzil_file );
Refreshes the $dzil_file from its written out context, determining if that file has been changed since addition or not, recording the relevant data for ->files
->files
update_disk_file
$dir->update_disk_file( $disk_path );
Assume $disk_path is a path of a NEW file and record it in ->files
$disk_path
update_input_files
$dir->update_input_files
Refresh the state of all written out files and record them ready for ->files
update_disk_files
$dir->update_disk_files
Scan the temporary directory for files that weren't added as an input file, and record their status and information ready for ->files
input
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.
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.
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");
Kent Fredric <kentnl@cpan.org>
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 the same terms as the Perl 5 programming language system itself.
To install Dist::Zilla::Role::Tempdir, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dist::Zilla::Role::Tempdir
CPAN shell
perl -MCPAN -e shell install Dist::Zilla::Role::Tempdir
For more information on module installation, please visit the detailed CPAN module installation guide.