CGI::Bus::file - file object
use CGI::Bus; $s =CGI::Bus->new(); $s->file(-name=>'t.txt', -mode=>'rwc')->store('aa','bb');
Current file lock, 0 or undef is used when unlocked
File access mode, default is 'r'
File permissions when to be created, default is 0666
- close -> self object
Close file opened
- dump ( data ) -> self object
- dump -> data dump loaded
- dumpload -> data dump loaded
- dumpstore ( data ) -> self object
- iofile ( ?file open args ) -> IO:File object
Returns internal IO::File object. Create it if not exists or if arguments present to open file. See
- load ( ?-asb, ?sub ) -> data loaded
Reads 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 there is no shared or exclusive lock, lock remains after operation.
seeks to the beginning of the file before read.
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.
- lock ( lock mode ) -> self object
- lock -> current lock mode
Locks or unlocks file, or returns current lock. Lock mode may be Fcntl 'LOCK_SH', 'LOCK_EX', 'LOCK_UN', or strings 'sh', 'ex', 'un' or '0'. 0 means unlocked file.
- open ( filename, ?mode, ?perm ) -> self object
Open file. Default mode is 'r', mode may be Fcntl constants like 'O_RDONLY', 'fopen' mode signs 'r', 'w', 'a', 'r+', 'a+', mode strings 'rw' for O_RDWR and 'rwc' for O_RDWR|O_CREAT. Default permission is 0666.
- seek ( position, ?whence ) -> self object
Filehandle positioning. Default positioning method is 0 - 'SEEK_SET'.
- store ( ?-b, data to store ) -> self object
Writes given data into file. Locks file with 'LOCK_EX' if there is no exclusive lock, lock remains after operation. Does not
storecall. Option '-b' chooses binary mode and binary write. Without '-b', each element of data list is printed with trailing "\n" added.
Implemented and Documented.
Andrew V Makarow <makarow at mail.com>
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 149:
You forgot a '=back' before '=head2'
- Around line 154:
=back without =over