No::Worries::Dir(3)
π NAME π
No::Worries::Dir(3) β directory handling without worries. It's a User Contributed Perl Documentation page, and it's here to make directory stuff feel way less feral. π
π οΈ SYNOPSIS π οΈ
use No::Worries::Dir
qw(dir_change dir_ensure dir_make dir_parent dir_read dir_remove);
# change directory
dir_change("/tmp");
# make sure a directory exists (not an error if it exists already)
dir_ensure("/tmp/some/path", mode => oct(770));
# make a directory (an error if it exists already)
dir_make("/tmp/some/path", mode => oct(770));
# find out the parent directory of some path
$parent = dir_parent($path);
dir_ensure($parent);
# read a directory
foreach $name (dir_read("/etc")) {
...
}
# remove a directory
dir_remove("/tmp/some/path");
π DESCRIPTION π
Okay so this module eases directory handling by giving you convenient wrappers around standard directory functions. All the functions die() on error. Not a vibe when something breaks, but at least it's consistent. π
β¨ FUNCTIONS β¨
This module provides the following functions (none of them being exported by default):
dir_change(PATH)β changes the working directory to the given path. It's a safe thin wrapper on top ofchdir(). πdir_ensure(PATH[, OPTIONS])β makes sure the given path is an existing directory, creating it (including its parents) if needed. Supported options:"mode"β numerical mode to use formkdir()(default:oct(777)). π οΈ
dir_make(PATH[, OPTIONS])β makes the given directory. It's a safe thin wrapper on top ofmkdir(). Supported options:"mode"β numerical mode to use formkdir()(default:oct(777)). β¨
dir_parent(PATH)β returns the parent directory of the given path. π§dir_read(PATH)β reads the given directory and returns its list of entries except.and... π¦dir_remove(PATH)β removes the given directory (that must exist and be empty). It's a safe thin wrapper on top ofrmdir(). π
yes bestie, it must exist and be empty β no sneaky non-empty dirs allowed. π
π SEE ALSO π
No::Worries. That's the whole list, and it's iconic. π
π AUTHOR π
Lionel Cons <http://cern.ch/lionel.cons> β hello legend. π«Ά
Copyright (C) CERN 2012-2019
And the footer energy: this page is from perl v5.32.1, dated 2021-10-18, and it's No::Worries::Dir(3). Slay. πβ¨
π¦ where this page comes from
- epel 9: perl-No-Worries 1.7-1.el9 Β· GPL+ or Artistic
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms