1Dir::Self(3)          User Contributed Perl Documentation         Dir::Self(3)
2
3
4

NAME

6       Dir::Self - a __DIR__ constant for the directory your source file is in
7

SYNOPSIS

9         use Dir::Self;
10
11         use lib __DIR__ . "/lib";
12
13         my $conffile = __DIR__ . "/config";
14

DESCRIPTION

16       Perl has two pseudo-constants describing the current location in your
17       source code, "__FILE__" and "__LINE__". This module adds "__DIR__",
18       which expands to the directory your source file is in, as an absolute
19       pathname.
20
21       This is useful if your code wants to access files in the same
22       directory, like helper modules or configuration data. This is a bit
23       like FindBin except it's not limited to the main program, i.e. you can
24       also use it in modules. And it actually works.
25
26       As of version 0.10 each use of "__DIR__" recomputes the directory name;
27       this ensures that files in different directories that share the same
28       package name get correct results. If you don't want this, "use
29       Dir::Self qw(:static)" will create a true "__DIR__" constant in your
30       package that contains the directory name at the point of "use".
31

AUTHOR

33       Lukas Mai <l.mai @web.de>
34
36       Copyright (C) 2007, 2008, 2013 by Lukas Mai
37
38       This library is free software; you can redistribute it and/or modify it
39       under the same terms as Perl itself, either Perl version 5.8.8 or, at
40       your option, any later version of Perl 5 you may have available.
41
42
43
44perl v5.32.1                      2021-01-27                      Dir::Self(3)
Impressum