NAME

Path::Extended::Entity

SYNOPSIS

use Path::Extended::File;
my $file = Path::Extended::File->new('path/to/some.file');

DESCRIPTION

This is a base class for Path::Extended::File and Path::Extended::Dir.

METHODS

new

creates an appropriate object. Note that this base class itself doesn't hold anything.

absolute

may take an optional hash, and returns an absolute path of the file/directory. Note that back slashes in the path will be converted to forward slashes unless you explicitly set a native option to true.

relative

may take an optional hash, and returns a relative path of the file/directory (compared to the current directory (Cwd::cwd) by default, but you may change this bahavior by passing a base option). Note that back slashes in the path will be converted to forward slashes unless you explicitly set a native option to true.

copy_to

copies the file/directory to the destination by File::Copy::copy.

move_to

moves the file/directory to the destination by File::Copy::move. If the file/directory is open, it'll automatically close.

rename_to

renames the file/directory. If the file/directory is open, it'll automatically close. If your OS allows rename of an open file, you may want to use built-in rename function for better atomicity.

unlinks the file/directory. The same thing can be said as for the rename_to method.

exists

returns true if the file/directory exists.

is_open

returns true if the file/directory is open.

parent

returns a Path::Extended::Dir object that points to the parent directory of the file/directory.

logger

You may optionally pass a logger object with log method that accepts ( loglevel = @log_messages )> array arguments to notifty when some (usually unfavorable) thing occurs. By default, a built-in Carp logger will be used. If you want to disable log, set a false value to logger.

log

You can pass a loglevel and arbitrary messages to the logger. References will be dumped with Data::Dump by default.

SEE ALSO

Path::Extended, Path::Extended::File, Path::Extended::Dir

AUTHOR

Kenichi Ishigaki, <ishigaki@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2008 by Kenichi Ishigaki.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.