The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Directory::Scanner::API::Stream - Streaming directory iterator abstract interface

VERSION

version 0.04

DESCRIPTION

This is a simple API role that defines what a stream object can do.

API METHODS

next

Get the next item in the stream.

The value currently being processed. This is always the same as the last value returned from next.

is_done

This indicates that the stream has been exhausted and that there is no more values to come from next.

This occurs *after* the last call to next that returned nothing.

close

This closes a stream and any subsequent calls to next will throw an error.

is_closed

This indicates that the stream has been closed, usually by someone calling the close method.

clone( ?$dir )

This will clone a given stream and can optionally be given a different directory to scan.

UTILITY METHODS

flatten

This will take a given stream and flatten it into an array.

recurse

By default a scanner will not try to recurse into subdirectories, if that is what you want, you must call this builder method.

See Directory::Scanner::Stream::Recursive for more info.

ignore($filter)

Construct a stream that will ignore anything that is matched by the $filter CODE ref.

See Directory::Scanner::Stream::Ignoring for more info.

match($predicate)

Construct a stream that will keep anything that is matched by the $predicate CODE ref.

See Directory::Scanner::Stream::Matching for more info.

apply($function)

Construct a stream that will apply the $function to each element in the stream without modifying it.

See Directory::Scanner::Stream::Application for more info.

transform($transformer)

Construct a stream that will apply the $transformer to each element in the stream and modify it.

See Directory::Scanner::Stream::Transformer for more info.

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.