Aion-Fs
view release on metacpan or search on metacpan
lib/Aion/Fs.pm view on Meta::CPAN
mkpath "A///./file";
-d "A" # -> 1
=head3 See also
=over
=item * L<File::Path> â C<mkpath("dir1/dir2")>.
=item * L<File::Path::Tiny> â C<File::Path::Tiny::mk($path)>. Does not throw exceptions.
=back
=head2 mtime (;$path)
Modification time of C<$path> in unixtime with fractional part (from C<Time::HiRes::stat>). Without a parameter, uses C<$_>.
Throws an exception if the file does not exist or does not have permission:
local $_ = "nofile";
eval { mtime }; $@ # ~> mtime nofile: No such file or directory
mtime ["/"] # ~> ^\d+(\.\d+)?$
=head3 See also
=over
=item * C<-M> â C<-M "file.txt">, C<-M _> in days from the current time.
=item * L<stat> â C<(stat "file.txt")[9]> in seconds (unixtime).
=item * L<Time::HiRes> â C<(Time::HiRes::stat "file.txt")[9]> in seconds with fractional part.
=item * L<Mojo::File> â C<< path($file)-E<gt>stat-E<gt>mtime >>.
=back
=head2 sta (;$path)
Returns statistics about the file. Without a parameter, uses C<$_>.
To be used with other file functions, it can receive a reference to an array from which it takes the first element as the file path.
Throws an exception if the file does not exist or does not have permission:
local $_ = "nofile";
eval { sta }; $@ # ~> sta nofile: No such file or directory
sta(["/"])->{ino} # ~> ^\d+$
sta(".")->{atime} # ~> ^\d+(\.\d+)?$
=head3 See also
=over
=item * L<Fcntl> â contains constants for mode recognition.
=item * L<BSD::stat> - optionally returns atime, ctime and mtime in nanoseconds, user flags and file generation number. Has an OOP interface.
=item * L<File::chmod> â C<chmod("o=,g-w","file1","file2")>, C<@newmodes = getchmod("+x","file1","file2")>.
=item * L<File::stat> â provides an OOP interface to stat.
=item * L<File::Stat::Bits> - similar to L<Fcntl>.
=item * L<File::stat::Extra> â extends L<File::stat> methods to obtain information about the mode, and also reloads B<-X>, B<< <=> >>, B<cmp> and B<~~> operators and is stringified.
=item * L<File::Stat::Ls> â returns the mode in the format of the ls utility.
=item * L<File::Stat::Moose> â OOP interface for Moose.
=item * L<File::Stat::OO> â provides an OOP interface to stat. Can return atime, ctime and mtime at once in C<DateTime>.
=item * L<File::Stat::Trigger> â monitors changes in file attributes.
=item * L<Linux::stat> â parses /proc/stat and returns additional information. However, it does not work on other OSes.
=item * L<Stat::lsMode> â returns the mode in the ls utility format.
=item * L<VMS::Stat> - returns VMS ACLs.
=back
=head2 path (;$path)
Splits a file path into its components or assembles it from its components.
=over
=item * If it receives a reference to an array, it treats its first element as a path.
=item * If it receives a link to a hash, it collects a path from it. Unfamiliar keys are simply ignored. The set of keys for each FS is different.
=item * FS is taken from the system variable C<$^O>.
=item * The file system is not accessed.
=back
{
local $^O = "freebsd";
path "." # --> {path => ".", file => ".", name => "."}
path ".bashrc" # --> {path => ".bashrc", file => ".bashrc", name => ".bashrc"}
path ".bash.rc" # --> {path => ".bash.rc", file => ".bash.rc", name => ".bash", ext => "rc"}
path ["/"] # --> {path => "/", dir => "/"}
local $_ = "";
path # --> {path => ""}
path "a/b/c.ext.ly" # --> {path => "a/b/c.ext.ly", dir => "a/b", file => "c.ext.ly", name => "c", ext => "ext.ly"}
path +{dir => "/", ext => "ext.ly"} # => /.ext.ly
path +{file => "b.c", ext => "ly"} # => b.ly
path +{path => "a/b/f.c", dir => "m"} # => m/f.c
local $_ = +{path => "a/b/f.c", dir => undef, ext => undef};
path # => f
path +{path => "a/b/f.c", volume => "/x", dir => "m/y/", file => "f.y", name => "j", ext => "ext"} # => m/y//j.ext
path +{path => "a/b/f.c", volume => "/x", dir => "/y", file => "f.y", name => "j", ext => "ext"} # => /y/j.ext
}
( run in 0.902 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )