SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG
DONATE


YUM REPOSITORY

 
 

MAN page from CentOS 8 perl-IO-1.40-452.module_el8.4.0+646+45e06e4a.x86_64.rpm

IO::Dir

Section: Perl Programmers Reference Guide (3pm)
Updated: 2019-10-24
Index 

NAME

IO::Dir - supply object methods for directory handles 

SYNOPSIS

    use IO::Dir;    $d = IO::Dir->new(".");    if (defined $d) {        while (defined($_ = $d->read)) { something($_); }        $d->rewind;        while (defined($_ = $d->read)) { something_else($_); }        undef $d;    }    tie %dir, 'IO::Dir', ".";    foreach (keys %dir) {        print $_, " " , $dir{$_}->size,"\n";    }
 

DESCRIPTION

The "IO::Dir" package provides two interfaces to perl's directory readingroutines.

The first interface is an object approach. "IO::Dir" provides an objectconstructor and methods, which are just wrappers around perl's built indirectory reading routines.

new ( [ DIRNAME ] )
"new" is the constructor for "IO::Dir" objects. It accepts one optionalargument which, if given, "new" will pass to "open"

The following methods are wrappers for the directory related functions builtinto perl (the trailing 'dir' has been removed from the names). See perlfuncfor details of these functions.

open ( DIRNAME )
read ()
seek ( POS )
tell ()
rewind ()
close ()

"IO::Dir" also provides an interface to reading directories via a tiedhash. The tied hash extends the interface beyond just the directoryreading routines by the use of "lstat", from the "File::stat" package,"unlink", "rmdir" and "utime".

tie %hash, 'IO::Dir', DIRNAME [, OPTIONS ]

The keys of the hash will be the names of the entries in the directory. Reading a value from the hash will be the result of calling"File::stat::lstat". Deleting an element from the hash will delete the corresponding file or subdirectory,provided that "DIR_UNLINK" is included in the "OPTIONS".

Assigning to an entry in the hash will cause the time stamps of the fileto be modified. If the file does not exist then it will be created. Assigninga single integer to a hash element will cause both the access and modification times to be changed to that value. Alternatively a reference toan array of two values can be passed. The first array element will be used toset the access time and the second element will be used to set the modificationtime. 

SEE ALSO

File::stat 

AUTHOR

Graham Barr. Currently maintained by the Perl Porters. Please report allbugs to <perlbugAATTperl.org>. 

COPYRIGHT

Copyright (c) 1997-2003 Graham Barr <gbarrAATTpobox.com>. All rights reserved.This program is free software; you can redistribute it and/ormodify it under the same terms as Perl itself.


 

Index

NAME
SYNOPSIS
DESCRIPTION
SEE ALSO
AUTHOR
COPYRIGHT

This document was created byman2html,using the manual pages.