Ancient
view release on metacpan or search on metacpan
lib/file.pm view on Meta::CPAN
=head2 is_writable
if (file::is_writable($path)) { ... }
Returns true if path is writable.
=head2 is_executable
if (file::is_executable($path)) { ... }
Returns true if path is executable.
=head2 is_link
if (file::is_link($path)) { ... }
Returns true if path is a symbolic link.
=head2 atime
my $epoch = file::atime($path);
Returns access time as epoch seconds, or -1 on error.
=head2 ctime
my $epoch = file::ctime($path);
Returns change time as epoch seconds, or -1 on error.
=head2 mode
my $mode = file::mode($path);
Returns file permission mode (e.g., 0644), or -1 on error.
=head2 unlink
my $ok = file::unlink($path);
Delete a file. Returns true on success.
=head2 copy
my $ok = file::copy($src, $dst);
Copy a file. Returns true on success. Preserves file permissions.
=head2 move
my $ok = file::move($src, $dst);
Move/rename a file. Returns true on success. Works across filesystems.
=head2 touch
my $ok = file::touch($path);
Create file or update modification time. Returns true on success.
=head2 chmod
my $ok = file::chmod($path, $mode);
Change file permissions. Returns true on success.
file::chmod('/path/to/file', 0755);
=head2 mkdir
my $ok = file::mkdir($path);
my $ok = file::mkdir($path, $mode);
Create a directory. Default mode is 0755. Returns true on success.
=head2 rmdir
my $ok = file::rmdir($path);
Remove an empty directory. Returns true on success.
=head2 readdir
my $entries = file::readdir($path);
Returns arrayref of directory entries (excluding . and ..).
=head2 atomic_spew
my $ok = file::atomic_spew($path, $data);
Write data atomically using a temp file + rename. Returns true on success.
This is safe against partial writes and power failures.
=head2 basename
my $name = file::basename($path);
Returns the filename portion of a path.
file::basename('/path/to/file.txt') # returns 'file.txt'
=head2 dirname
my $dir = file::dirname($path);
Returns the directory portion of a path.
file::dirname('/path/to/file.txt') # returns '/path/to'
=head2 extname
my $ext = file::extname($path);
Returns the file extension including the dot.
file::extname('/path/to/file.txt') # returns '.txt'
=head2 join
my $path = file::join(@parts);
Join path components with the appropriate separator.
file::join('path', 'to', 'file') # returns 'path/to/file'
=head2 head
( run in 1.877 second using v1.01-cache-2.11-cpan-39bf76dae61 )