CGI::Bus::fut - File and directory utils library
use CGI::Bus; $s =CGI::Bus->new(); $s->fut->mkdir(directory);
This module contains several file and directory methods. See CGI::Bus::Base for inherited slots and methods.
copy, delete, find, glob, globn, mkdir, rmpath, size
copy
delete
find
glob
globn
mkdir
rmpath
size
fcompare, fhandle, fload, fstore, fdumpload, fdumpstore
fcompare
fhandle
fload
fstore
fdumpload
fdumpstore
None
Copy files and directories. Options: 'r'ecurse subdirectories, 'd'irectory target hint, 'f'ile target hint, 'i'gnore errors - continue copying.
Delete files and directories. Options: 'r'ecurse subdirectories, 'i'gnore errors - continue deleting.
Compare files using File::Compare
Store and load data structure to or from file using fstore, fload, CGI::Bus::dumpout, CGI::Bus::dumpin
Selects given filehandle, evals sub, reselects previously selected handle. For filename, temporarily opens file with handle 'HANDLE', selects this handle, evals sub... Returns result of sub.
Find files and directories with given mask and evaluates sub, locally setting $_ to filename. Returns number of sub agrees. There may be several subs and several filemasks for each sub, and they will be executed within one transaction of find call. Uses FileGlob
FileGlob
Options: 'i'gnore stat errors, '!' - not, 'd'irectories, 'l'ow before deep scan, 'm'ountpoints, 'r'ecurse directories, 's'ymlinks.
Parameters of sub are local $_ with full current filename, $_[0] with reference to @stat array, $_[1] with path, $_[2] with filename. Sub can return undefined value in $_ to signal stop, determine directories with $_[0]->[2] & 0040000, prevent recursing by assigning $_[0]->[2] =0.
Reads given file into memory as array or list ('-a'), text scalar ('-s'), binary scalar ('-b'). Default, '-a' or '-b', is determined with wantarray. Locks file with 'LOCK_SH'.
If sub is defined, it is evaluated for each row read into local $_, and with '-a' option results of each evaluation are returned as a list, true is returned otherwise.
Writes given data into given file. Locks file with 'LOCK_EX'. Option '-b' chooses binary mode and binary write. Without '-b', each element of data list is printed with trailing "\n" added. Prepend file name with '>' sign to append to file existed.
Glob filenames with mask and return list of them such as standard glob function. When $^O eq 'MSWin32' own implementation with fragments from File::DosGlob is used, else glob is called.
Like glob, but returns list of names only, without paths
Create path like standard mkdir call, but with base directories if needed, and optional permission mask (0777 default).
Remove path, with base directories, if empty. Returns the number of directories deleted.
Compute size of files and directories. Uses find and it's options.
Implemented and Documented.
Andrew V Makarow <makarow at mail.com>
3 POD Errors
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head1'
You forgot a '=back' before '=head2'
=back without =over
To install CGI::Bus, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CGI::Bus
CPAN shell
perl -MCPAN -e shell install CGI::Bus
For more information on module installation, please visit the detailed CPAN module installation guide.