Directory::Scanner - Streaming directory scanner
version 0.04
# get all entries in a directory my $stream = Directory::Scanner->for( $dir ); # get all entries in a directory recursively my $stream = Directory::Scanner->for( $dir ) ->recurse; # get all entries in a directory recusively # and filter out anything that is not a directory my $stream = Directory::Scanner->for( $dir ) ->recurse ->match(sub { $_->is_dir }); # ignore anything that is a . directory, then recurse my $stream = Directory::Scanner->for( $dir ) ->ignore(sub { $_->basename =~ /^\./ }) ->recurse;
This module provides a streaming interface for traversing directories. Unlike most modules that provide similar capabilities, this will not pre-fetch the list of files or directories, but instead will only focus on one thing at a time. This is useful if you have a large directory tree and need to do a lot of resource intensive work on each file.
This module uses the builder pattern to create the Directory::Scanner stream you need. If you look in the SYNOPSIS above you can see that the for method starts the creation of a builder. All the susequent chained methods simply wrap the original stream and perform the task needed.
for
See the "API METHODS" section of Directory::Scanner::API::Stream.
for($dir)
Constructs a stream for scanning the given $dir.
$dir
concat(@streams)
This concatenates multiple streams into a single stream, and will return an instance that concats the streams together.
Stevan Little <stevan@cpan.org>
This software is copyright (c) 2017, 2018 by Stevan Little.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Directory::Scanner, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Directory::Scanner
CPAN shell
perl -MCPAN -e shell install Directory::Scanner
For more information on module installation, please visit the detailed CPAN module installation guide.