Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

io::dir(3pm) [redhat man page]

IO::Dir(3pm)						 Perl Programmers Reference Guide					      IO::Dir(3pm)

NAME
IO::Dir - supply object methods for directory handles SYNOPSIS
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; } tie %dir, IO::Dir, "."; foreach (keys %dir) { print $_, " " , $dir{$_}->size," "; } DESCRIPTION
The "IO::Dir" package provides two interfaces to perl's directory reading routines. The first interface is an object approach. "IO::Dir" provides an object constructor and methods, which are just wrappers around perl's built in directory reading routines. new ( [ DIRNAME ] ) "new" is the constuctor for "IO::Dir" objects. It accepts one optional argument which, if given, "new" will pass to "open" The following methods are wrappers for the directory related functions built into perl (the trailing `dir' has been removed from the names). See perlfunc for details of these functions. open ( DIRNAME ) read () seek ( POS ) tell () rewind () close () "IO::Dir" also provides an interface to reading directories via a tied HASH. The tied HASH extends the interface beyond just the directory reading 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 call "unlink" providing that "DIR_UNLINK" is passed in the "OPTIONS". 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 cre- ated. Assigning a single integer to a HASH element will cause both the access and modification times to be changed to that value. Alterna- tively 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 ele- ment will be used to set the modification time. SEE ALSO
File::stat AUTHOR
Graham Barr. Currently maintained by the Perl Porters. Please report all bugs to <perl5-porters@perl.org>. COPYRIGHT
Copyright (c) 1997-8 Graham Barr <gbarr@pobox.com>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.8.0 2002-06-01 IO::Dir(3pm)

Check Out this Related Man Page

MooseX::Types::Path::Class(3pm) 			User Contributed Perl Documentation			   MooseX::Types::Path::Class(3pm)

NAME
MooseX::Types::Path::Class - A Path::Class type library for Moose SYNOPSIS
package MyClass; use Moose; use MooseX::Types::Path::Class; with 'MooseX::Getopt'; # optional has 'dir' => ( is => 'ro', isa => 'Path::Class::Dir', required => 1, coerce => 1, ); has 'file' => ( is => 'ro', isa => 'Path::Class::File', required => 1, coerce => 1, ); # these attributes are coerced to the # appropriate Path::Class objects MyClass->new( dir => '/some/directory/', file => '/some/file' ); DESCRIPTION
MooseX::Types::Path::Class creates common Moose types, coercions and option specifications useful for dealing with Path::Class objects as Moose attributes. Coercions (see Moose::Util::TypeConstraints) are made from both 'Str' and 'ArrayRef' to both Path::Class::Dir and Path::Class::File objects. If you have MooseX::Getopt installed, the Getopt option type ("=s") will be added for both Path::Class::Dir and Path::Class::File. EXPORTS
None of these are exported by default. They are provided via MooseX::Types. Dir, File These exports can be used instead of the full class names. Example: package MyClass; use Moose; use MooseX::Types::Path::Class qw(Dir File); has 'dir' => ( is => 'ro', isa => Dir, required => 1, coerce => 1, ); has 'file' => ( is => 'ro', isa => File, required => 1, coerce => 1, ); Note that there are no quotes around Dir or File. is_Dir($value), is_File($value) Returns true or false based on whether $value is a valid Dir or File. to_Dir($value), to_File($value) Attempts to coerce $value to a Dir or File. Returns the coerced value or false if the coercion failed. DEPENDENCIES
Moose, MooseX::Types, Path::Class BUGS AND LIMITATIONS
If you find a bug please either email the author, or add the bug to cpan-RT <http://rt.cpan.org>. AUTHOR
Todd Hepler "<thepler@employees.org>" LICENCE AND COPYRIGHT
Copyright (c) 2007-2008, Todd Hepler "<thepler@employees.org>". This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic. perl v5.10.1 2008-07-09 MooseX::Types::Path::Class(3pm)
Man Page