Debian Codegraph @

README

raw
1 NAME
2 Filesys::Virtual::Plain - A Plain virtual filesystem
3
4 SYNOPSIS
5 use Filesys::Virtual::Plain;
6
7 my $fs = Filesys::Virtual::Plain->new();
8
9 $fs->login('xantus', 'supersekret');
10
11 print foreach ($fs->list('/'));
12
13 DESCRIPTION
14 This module is used by other modules to provide a pluggable filesystem.
15
16 CONSTRUCTOR
17 new()
18 You can pass the initial cwd, root_path, and home_path as a hash.
19
20 METHODS
21 login($username, $password, $become)
22 Logs in a user. Returns 0 on failure. If $username is 'anonymous' then
23 it will try to login as 'ftp' with no password. If $become is defined
24 then it will try to change ownership of the process to the uid/gid of
25 the logged in user. BEWARE of the consequences of using $become. login()
26 also sets the uid, gid, home, gids, home_path, and chdir to the users'.
27
28 cwd
29 Gets or sets the current directory, assumes / if blank. This is used in
30 conjunction with the root_path for file operations. No actual change
31 directory takes place.
32
33 root_path($path)
34 Get or set the root path. All file paths are off this and cwd For
35 example:
36
37 $self->root_path('/home/ftp');
38 $self->cwd('/test');
39 $self->size('testfile.txt');
40
41 The size command would get the size for file /home/ftp/test/testfile.txt
42 not /test/testfile.txt
43
44 chmod($mode,$file)
45 chmod's a file.
46
47 modtime($file)
48 Gets the modification time of a file in YYYYMMDDHHMMSS format.
49
50 size($file)
51 Gets the size of a file in bytes.
52
53 delete($file)
54 Deletes a file, returns 1 or 0 on success or failure.
55
56 chdir($dir)
57 Changes the cwd to a new path from root_path. Returns undef on failure
58 or the new path on success.
59
60 mkdir($dir, $mode)
61 Creats a directory with $mode (defaults to 0755) and chown()'s the
62 directory with the uid and gid. The return value is from mkdir().
63
64 rmdir($dir)
65 Deletes a directory or file if -d test fails. Returns 1 on success or 0
66 on failure.
67
68 list($dir)
69 Returns an array of the files in a directory.
70
71 list_details($dir)
72 Returns an array of the files in ls format.
73
74 stat($file)
75 Does a normal stat() on a file or directory
76
77 test($test,$file)
78 Perform a perl type test on a file and returns the results.
79
80 For example to perform a -d on a directory.
81
82 $self->test('d','/testdir');
83
84 See filetests in perlfunc (commandline: perldoc perlfunc)
85
86 open_read($file,[params])
87 Opens a file with IO::File. Params are passed to open() of IO::File. It
88 returns the file handle on success or undef on failure. This could be
89 technically be used for any sort of open operation. See IO::File's open
90 method.
91
92 close_read($fh)
93 Performs a $fh->close()
94
95 open_write($fh, $append)
96 Performs an $fh->open(">$file") or $fh->open(">>$file") if $append is
97 defined. Returns the filehandle on success or undef on failure.
98
99 close_write($fh)
100 Performs a $fh->close()
101
102 seek($fh, $pos, $wence)
103 Performs a $fh->seek($pos, $wence). See IO::Seekable.
104
105 utime($atime, $mtime, @files)
106 Performs a utime() on the file(s). It changes the access time and mod
107 time of those files.
108
109 AUTHOR
110 David Davis, <[email protected]>, http://teknikill.net/
111
112 LICENSE
113 This library is free software; you can redistribute it and/or modify it
114 under the same terms as Perl itself.
115
116 SEE ALSO
117 perl(1), Filesys::Virtual, Filesys::Virtual::SSH,
118 Filesys::Virtual::DAAP, POE::Component::Server::FTP, Net::DAV::Server,
119 HTTP::Daemon, http://perladvent.org/2004/20th/
120