Brent Royal-Gordon > Dir-Iterate-0.01 > Dir::Iterate

Download:
Dir-Iterate-0.01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source  

NAME ^

Dir::Iterate - map/grep-style directory traversal

SYNOPSIS ^

    use Dir::Iterate;
    
    my @config_dirs = grepdir { -d } '/etc';
    my @filenames = mapdir { (split '/')[-1] } $ENV{HOME}, '/usr';

DESCRIPTION ^

Dir::Iterate implements equivalents to the built-in map and grep functions which traverse directories instead of arrays. The block will be called for each file and directory below the given list of directories. It acts as a more usable layer on top of File::Find.

Functions

mapdir { ... } $path1[, $path2...]

The block is called for each file, folder, or other filesystem entity under the given path(s). The full path to the object is in $_. The return value or values of the block are collected together and returned in a list.

grepdir { ... } $path1[, $path2...]

The block is called for each file, folder, or other filesystem entity under the given path(s). The full path to the object is in $_. If the return value of the block is true, the full path will be in the list returned by the method.

EXPORTS ^

mapdir and grepdir by default.

AUTHOR ^

Brent Royal-Gordon <brentdax@cpan.org>, for the University of Kent.

LICENSE ^

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

syntax highlighting: