home *** CD-ROM | disk | FTP | other *** search
-
- <HTML>
- <HEAD>
- <TITLE>IO::Dir - supply object methods for directory handles</TITLE>
- <LINK REL="stylesheet" HREF="../../Active.css" TYPE="text/css">
- <LINK REV="made" HREF="mailto:">
- </HEAD>
-
- <BODY>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> IO::Dir - supply object methods for directory handles</P></STRONG>
- </TD></TR>
- </TABLE>
-
- <A NAME="__index__"></A>
- <!-- INDEX BEGIN -->
-
- <UL>
-
- <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
-
- <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
- <LI><A HREF="#description">DESCRIPTION</A></LI>
- <LI><A HREF="#see also">SEE ALSO</A></LI>
- <LI><A HREF="#author">AUTHOR</A></LI>
- <LI><A HREF="#copyright">COPYRIGHT</A></LI>
- </UL>
- <!-- INDEX END -->
-
- <HR>
- <P>
- <H1><A NAME="name">NAME</A></H1>
- <P>IO::Dir - supply object methods for directory handles</P>
- <P>
- <HR>
- <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
- <UL>
- <LI>Linux</LI>
- <LI>Solaris</LI>
- <LI>Windows</LI>
- </UL>
- <HR>
- <H1><A NAME="synopsis">SYNOPSIS</A></H1>
- <PRE>
- use IO::Dir;
- $d = new IO::Dir ".";
- if (defined $d) {
- while (defined($_ = $d->read)) { something($_); }
- $d->rewind;
- while (defined($_ = $d->read)) { something_else($_); }
- undef $d;
- }</PRE>
- <PRE>
- tie %dir, IO::Dir, ".";
- foreach (keys %dir) {
- print $_, " " , $dir{$_}->size,"\n";
- }</PRE>
- <P>
- <HR>
- <H1><A NAME="description">DESCRIPTION</A></H1>
- <P>The <CODE>IO::Dir</CODE> package provides two interfaces to perl's directory reading
- routines.</P>
- <P>The first interface is an object approach. <CODE>IO::Dir</CODE> provides an object
- constructor and methods, which are just wrappers around perl's built in
- directory reading routines.</P>
- <DL>
- <DT><STRONG><A NAME="item_new">new ( [ DIRNAME ] )</A></STRONG><BR>
- <DD>
- <A HREF="#item_new"><CODE>new</CODE></A> is the constuctor for <CODE>IO::Dir</CODE> objects. It accepts one optional
- argument which, if given, <A HREF="#item_new"><CODE>new</CODE></A> will pass to <A HREF="#item_open"><CODE>open</CODE></A>
- <P></P></DL>
- <P>The following methods are wrappers for the directory related functions built
- into perl (the trailing `dir' has been removed from the names). See <A HREF="../../lib/Pod/perlfunc.html">the perlfunc manpage</A>
- for details of these functions.</P>
- <DL>
- <DT><STRONG><A NAME="item_open">open ( DIRNAME )</A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_read">read ()</A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_seek">seek ( POS )</A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_tell">tell ()</A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_rewind">rewind ()</A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_close">close ()</A></STRONG><BR>
- <DD>
- </DL>
- <P><CODE>IO::Dir</CODE> also provides a interface to reading directories via a tied
- HASH. The tied HASH extends the interface beyond just the directory
- reading routines by the use of <A HREF="../../lib/Pod/perlfunc.html#item_lstat"><CODE>lstat</CODE></A>, from the <CODE>File::stat</CODE> package,
- <A HREF="../../lib/Pod/perlfunc.html#item_unlink"><CODE>unlink</CODE></A>, <A HREF="../../lib/Pod/perlfunc.html#item_rmdir"><CODE>rmdir</CODE></A> and <A HREF="../../lib/Pod/perlfunc.html#item_utime"><CODE>utime</CODE></A>.</P>
- <DL>
- <DT><STRONG><A NAME="item_tie_%25hash%2C_IO%3A%3ADir%2C_DIRNAME_%5B%2C_OPTIO">tie %hash, IO::Dir, DIRNAME [, OPTIONS ]</A></STRONG><BR>
- <DD>
- </DL>
- <P>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
- <CODE>File::stat::lstat</CODE>. Deleting an element from the hash will call <A HREF="../../lib/Pod/perlfunc.html#item_unlink"><CODE>unlink</CODE></A>
- providing that <CODE>DIR_UNLINK</CODE> is passed in the <CODE>OPTIONS</CODE>.</P>
- <P>Assigning to an entry in the HASH will cause the time stamps of the file
- to be modified. If the file does not exist then it will be created. Assigning
- a single integer to a HASH element will cause both the access and
- modification times to be changed to that value. Alternatively a reference to
- an array of two values can be passed. The first array element will be used to
- set the access time and the second element will be used to set the modification
- time.</P>
- <P>
- <HR>
- <H1><A NAME="see also">SEE ALSO</A></H1>
- <P><A HREF="../../lib/File/stat.html">the File::stat manpage</A></P>
- <P>
- <HR>
- <H1><A NAME="author">AUTHOR</A></H1>
- <P>Graham Barr. Currently maintained by the Perl Porters. Please report all
- bugs to <<A HREF="mailto:perl5-porters@perl.org">perl5-porters@perl.org</A>>.</P>
- <P>
- <HR>
- <H1><A NAME="copyright">COPYRIGHT</A></H1>
- <P>Copyright (c) 1997-8 Graham Barr <<A HREF="mailto:gbarr@pobox.com">gbarr@pobox.com</A>>. All rights reserved.
- This program is free software; you can redistribute it and/or
- modify it under the same terms as Perl itself.</P>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> IO::Dir - supply object methods for directory handles</P></STRONG>
- </TD></TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-