NAME

Path::Extended::Dir

SYNOPSIS

use Path::Extended::Dir;

my $dir = Path::Extended::Dir->new('path/to/somewhere');
my $parent_dir = Path::Extended::Dir->new_from_file('path/to/some.file');

foreach my $file ( $dir->find('*.txt') ) {
  print $file->relative, "\n";  # each $file is a L<Path::Extended::File> object.
}

DESCRIPTION

This class implements several directory-specific methods. See also Path::Class::Entity for common methods like copy and move.

METHODS

new, new_from_file

takes a path or parts of a path of a directory (or a file in the case of new_from_file), and creates a Path::Extended::Dir object. If the path specified is a relative one, it will be converted to the absolute one internally.

open, close, read, seek, tell, rewind

are simple wrappers of the corresponding built-in functions (with the trailing 'dir').

mkdir

makes the directory via File::Path::mkpath.

rmdir

removes the directory via File::Path::rmtree.

find, find_dir

takes a File::Find::Rule's rule and a hash option, and returns Path::Extended::* objects of the matched files (find) or directories (find_dir) under the directory the $self object points to. Options are:

callback

You can pass a code reference to filter the objects.

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.