The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Directory::Scanner - Streaming directory scanner

VERSION

version 0.04

SYNOPSIS

    # 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;

DESCRIPTION

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.

Builders

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.

Streams

See the "API METHODS" section of Directory::Scanner::API::Stream.

METHODS

for($dir)

Constructs a stream for scanning the given $dir.

concat(@streams)

This concatenates multiple streams into a single stream, and will return an instance that concats the streams together.

AUTHOR

Stevan Little <stevan@cpan.org>

COPYRIGHT AND LICENSE

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.