PerlIO::dir - Reads directories


PerlIO-Util documentation Contained in the PerlIO-Util distribution.

Index


Code Index:

NAME

Top

PerlIO::dir - Reads directories

SYNOPSIS

Top

	open my $dirh, '<:dir', '.';

	binmode $dirh, ':encoding(cp932)'; # OK

	my @dirs = <$dirh>; # added "\n" at the end of the name
	chomp @dirs; # if necessary

DESCRIPTION

Top

PerlIO::dir provides an interface to directory reading functions, opendir(), readdir(), rewinddir and closedir().

However, there is an important difference between :dir and Perl's readdir(). This layer appends a newline code, \n, to the end of the name, because readline() requires input separators. Call chomp() if necessary.

You can use seek($dirh, 0, 0) for rewinddir().

SEE ALSO

Top

opendir in perlfunc, readdir in perlfunc, rewinddir in perlfunc, closedir in perlfunc.

PerlIO::Util.

AUTHOR

Top

Goro Fuji (藤 吾郎) <gfuji (at) cpan.org>

LICENSE AND COPYRIGHT

Top


PerlIO-Util documentation Contained in the PerlIO-Util distribution.

package PerlIO::dir;
use strict;
require PerlIO::Util;
1;
__END__