Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

dir::self(3pm) [debian man page]

Dir::Self(3pm)						User Contributed Perl Documentation					    Dir::Self(3pm)

NAME
Dir::Self - a __DIR__ constant for the directory your source file is in SYNOPSIS
use Dir::Self; use lib __DIR__ . "/lib"; my $conffile = __DIR__ . "/config"; DESCRIPTION
Perl has two pseudo-constants describing the current location in your source code, "__FILE__" and "__LINE__". This module adds "__DIR__", which expands to the directory your source file is in, as an absolute pathname. This is useful if your code wants to access files in the same directory, like helper modules or configuration data. This is a bit like FindBin except it's not limited to the main program, i.e. you can also use it in modules. And it actually works. As of version 0.10 each use of "__DIR__" recomputes the directory name; this ensures that files in different directories that share the same package name get correct results. If you don't want this, "use Dir::Self qw(:static)" will create a true "__DIR__" constant in your package that contains the directory name at the point of "use". AUTHOR
Lukas Mai <l.mai @web.de> COPYRIGHT AND LICENSE
Copyright (C) 2007, 2008 by Lukas Mai This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available. perl v5.10.1 2008-05-11 Dir::Self(3pm)

Check Out this Related 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 = 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," "; } 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 constructor 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 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 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. SEE ALSO
File::stat AUTHOR
Graham Barr. Currently maintained by the Perl Porters. Please report all bugs to <perlbug@perl.org>. COPYRIGHT
Copyright (c) 1997-2003 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.18.2 2013-11-04 IO::Dir(3pm)
Man Page