Dist::Zilla::Tempdir::Item - A result object for things that DO() DZ::R::Tempdir;
version 1.001003
my $foo = Dist::Zilla::Tempdir::Item->new( name => 'Path/To/File.txt', file => $dzilfile, ); $foo->set_new; $foo->is_new; # true $foo->is_deleted; # false $foo->set_deleted; $foo->is_new; # false $foo->is_deleted; # true.
Ultimately, I figured using a character with "eq" every where in extending code was a way to extra bugs that were hard to detect. Going via all the Object-Oriented niceness you'll probably incur* a small performance penalty, but things going Bang when you make a typo or add invisible white-space is a Good Thing.
eq
* albeit immeasurably insignificant in size, especially for something that will only take 15 seconds of run-time every once in a while, not to mention the overhead is drowned by the fact we're doing file-system IO and running many of the files through a complete hashing algorithm to test for modification.
isa => Str, is => rw,
The internal status character. You can mangle this yourself if you want, and for compatibility with older versions of this dist, you may even have to, but try not to, if it breaks, something something something pieces.
Using the is_* and set_* accessors is a much smarter idea.
At present, the characters M, O, N and D have defined meanings, but this could change. ( Its not even unforeseeable expanding it to be 2 characters to represent different parts of state, I probably will not do that, but do not pretend I will not ;) )
isa => Dist::Zilla::Role::File, required => 1, is => rw
This is the Dist::Zilla::File::* item which we refer to. For items that is_deleted, file is likely to be the file before it got deleted.
is_deleted
file
For is_new and is_original files, the item is the file itself, and for is_modified, its the modified version of the file.
is_new
is_original
is_modified
Proxy for $item->file->name
$item->file->name
This is the path to the file relative to the dist root.
returns if the file is modified or not.
sets the state to 'modified'
returns if the file is the original file or not.
sets the state to 'original'
returns if the file is new or not ( that is, if it wasn't in the dist prior to executing the given code ).
sets the state to 'new'
returns if the file is deleted or not ( that is, if it were deleted during the execution phase )
sets the state to 'deleted'
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.