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

NAME

6       No::Worries::Dir - directory handling without worries
7

SYNOPSIS

9         use No::Worries::Dir
10             qw(dir_change dir_ensure dir_make dir_parent dir_read dir_remove);
11
12         # change directory
13         dir_change("/tmp");
14
15         # make sure a directory exists (not an error if it exists already)
16         dir_ensure("/tmp/some/path", mode => oct(770));
17
18         # make a directory (an error if it exists already)
19         dir_make("/tmp/some/path", mode => oct(770));
20
21         # find out the parent directory of some path
22         $parent = dir_parent($path);
23         dir_ensure($parent);
24
25         # read a directory
26         foreach $name (dir_read("/etc")) {
27             ...
28         }
29
30         # remove a directory
31         dir_remove("/tmp/some/path");
32

DESCRIPTION

34       This module eases directory handling by providing convenient wrappers
35       around standard directory functions. All the functions die() on error.
36

FUNCTIONS

38       This module provides the following functions (none of them being
39       exported by default):
40
41       dir_change(PATH)
42           change the working directory to the given path; this is a safe thin
43           wrapper on top of chdir()
44
45       dir_ensure(PATH[, OPTIONS])
46           make sure the given path is an existing directory, creating it
47           (including its parents) if needed; supported options:
48
49           ·   "mode": numerical mode to use for mkdir() (default: oct(777))
50
51       dir_make(PATH[, OPTIONS])
52           make the given directory; this is a safe thin wrapper on top of
53           mkdir(); supported options:
54
55           ·   "mode": numerical mode to use for mkdir() (default: oct(777))
56
57       dir_parent(PATH)
58           return the parent directory of the given path
59
60       dir_read(PATH)
61           read the given directory and return its list of entries except "."
62           and ".."
63
64       dir_remove(PATH)
65           remove the given directory (that must exist and be empty); this is
66           a safe thin wrapper on top of rmdir()
67

SEE ALSO

69       No::Worries.
70

AUTHOR

72       Lionel Cons <http://cern.ch/lionel.cons>
73
74       Copyright (C) CERN 2012-2019
75
76
77
78perl v5.32.0                      2020-07-28               No::Worries::Dir(3)
Impressum