Why not adopt me?
NAME
Dist::Zilla::Tempdir::Item - A result object for things that DO() DZ::R::Tempdir;
VERSION
version 0.01022319
SYNOPSIS
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.
ATTRIBUTES
status
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 ;] )
file
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.
For is_new
and is_original
files, the item is the file itself, and for is_modified
, its the modified version of the file.
name
isa => Str,
required => 1,
is => rw,
This is the path to the file relative to the dist root.
METHODS
is_modified
returns if the file is modified or not.
set_modified
sets the state to 'modified'
is_original
returns if the file is the original file or not.
set_original
sets the state to 'original'
is_new
returns if the file is new or not ( that is, if it wasn't in the dist prior to executing the given code ).
set_new
sets the state to 'new'
is_deleted
returns if the file is deleted or not ( that is, if it were deleted during the execution phase )
set_deleted
sets the state to 'deleted'
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.