Plain(3pm)
π NAME π
okay bestie, say hi to Filesys::Virtual::Plain β it's A Plain virtual filesystem. yes, that's the whole name, it's giving minimal and we respect it β¨
This page lives in the User Contributed Perl Documentation section, and it's the Plain(3pm) girlie. π
πΈ SYNOPSIS πΈ
here's the vibe, copy-paste it exactly, no cap:
use Filesys::Virtual::Plain;
my $fs = Filesys::Virtual::Plain->new();
$fs->login('xantus', 'supersekret');
print foreach ($fs->list('/'));
likeβ¦ make the object, log in, print everything in /. slay. π
π¦ DESCRIPTION π¦
This module is used by other modules to provide a pluggable filesystem. it's the behind-the-scenes bestie, the main character who lets everyone else shine. π«Ά
π CONSTRUCTOR π
β¨ new()
You can pass the initial cwd, root_path, and home_path as a hash. that's it, that's the tea π
π METHODS π
π login($username, $password, $become)
Logs in a user. Returns 0 on failure. π¨
If $username is 'anonymous' then it will try to login as 'ftp' with no password β sneaky lil anonymous era, we love it.
If $become is defined then it will try to change ownership of the process to the uid/gid of the logged in user.
β οΈ BEWARE of the consequences of using $become. like, actually beware. this is not a drill bestie π
login() also sets the uid, gid, home, gids, home_path, and chdir to the users'. so it does a LOT. multitasking queen π
πΈ cwd
Gets or sets the current directory, assumes / if blank. This is used in conjunction with the root_path for file operations. No actual change directory takes place β it's all vibes, nothing physical. π§
π root_path($path)
Get or set the root path. All file paths are off this and cwd. For example:
$self->root_path('/home/ftp');
$self->cwd('/test');
$self->size('testfile.txt');
The size command would get the size for file /home/ftp/test/testfile.txt not /test/testfile.txt. iykyk β the paths stack, okay?? β¨
π¦ chmod($mode,$file)
chmod's a file. short king of a method, does exactly what it says π
β modtime($file)
Gets the modification time of a file in YYYYMMDDHHMMSS format. that format. memorize it. it's iconic. π
π size($file)
Gets the size of a file in bytes. numbers don't lie bestie π
π delete($file)
Deletes a file, returns 1 or 0 on success or failure. binary queen, she doesn't do in-between π
π§ chdir($dir)
Changes the cwd to a new path from root_path. Returns undef on failure or the new path on success. so if you get undef, that's your sign, bestie π«Ά
π mkdir($dir, $mode)
Creats a directory with $mode (defaults to 0755) and chown()'s the directory with the uid and gid. The return value is from mkdir().
note: yes, it really says "Creats" in the original. we keep the lore. π
πΈ rmdir($dir)
Deletes a directory or file if -d test fails. Returns 1 on success or 0 on failure. so it's a little bit of a both-jobs icon π
π list($dir)
Returns an array of the files in a directory. just the names, quick and cute β¨
π list_details($dir)
Returns an array of the files in ls format. the full glam version, all the deets π
β stat($file)
Does a normal stat() on a file or directory. no notes. π
π¦ test($test,$file)
Perform a perl type test on a file and returns the results.
For example to perform a -d on a directory:
$self->test('d','/testdir');
See filetests in perlfunc (commandline: perldoc perlfunc). go read it, i'll wait π«Ά
π open_read($file,[params])
Opens a file with IO::File. Params are passed to open() of IO::File. It returns the file handle on success or undef on failure. This could be technically be used for any sort of open operation. See IO::File's open method. versatile legend β¨
π close_read($fh)
Performs a $fh->close(). tiny method, big energy π
π open_write($fh, $append)
Performs an $fh->open(">$file") or $fh->open(">>$file") if $append is defined. Returns the filehandle on success or undef on failure. so if $append is defined you're appending, periodt π₯
π§ close_write($fh)
Performs a $fh->close(). yes, same as close_read. she's consistent π
π seek($fh, $pos, $wence)
Performs a $fh->seek($pos, $wence). See IO::Seekable. (and yes, it's spelled wence β we don't make the rules, we just document them π)
β utime($atime, $mtime, @files)
Performs a utime() on the file(s). It changes the access time and mod time of those files. two timestamps, many files, one iconic call π
πΈ AUTHOR πΈ
David Davis, <xantus@cpan.org>, http://teknikill.net/
π LICENSE π
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π«Ά
β¨ SEE ALSO β¨
perl(1)Filesys::VirtualFilesys::Virtual::SSHFilesys::Virtual::DAAPPOE::Component::Server::FTPNet::DAV::ServerHTTP::Daemon- http://perladvent.org/2004/20th/
and that's the whole page bestie, no crumbs left π
perl v5.36.0, dated 2022-11-19 β so like, a vintage icon, and still eating. bye, ily, go read perlfunc πβ¨π¦
π¦ where this page comes from
- debian bookworm: libfilesys-virtual-plain-perl 0.10-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libfilesys-virtual-plain-perl 0.10-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libfilesys-virtual-plain-perl 0.10-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libfilesys-virtual-plain-perl 0.10-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libfilesys-virtual-plain-perl 0.10-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms