- COPYRIGHT AND LICENSE
Dist::Zilla::Tempdir::Item - A result object for things that DO() DZ::R::Tempdir;
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.
* 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
file is likely to be the file before it got deleted.
is_original files, the item is the file itself, and for
is_modified, its the modified version of the file.
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 <email@example.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 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.