|
NAMEFile::Monitor::Object - Monitor a filesystem object for changes.VERSIONThis document describes File::Monitor::Object version 1.00SYNOPSISCreated by File::Monitor to monitor a single file or directory.use File::Monitor; use File::Monitor::Object; my $monitor = File::Monitor->new(); for my $file ( @files ) { $monitor->watch( $file ); } # First scan just finds out about the monitored files. No changes # will be reported. $monitor->scan; # Later perform a scan and gather any changes for my $change ( $monitor->scan ) { # $change is a File::Monitor::Delta } DESCRIPTIONMonitors changes to a single file or directory. Don't create a "File::Monitor::Object" directly; instead call "watch" on File::Monitor.A "File::Monitor::Object" represents a single file or directory. The corresponding file or directory need not exist; a file being created is one of the events that is monitored for. Similarly if the file or directory is deleted that will be reported as a change. Changes of state are returned as a File::Monitor::Delta object. The state of the monitored file or directory at the time of the last "scan" can be queried. Before "scan" is called these methods will all return "undef". The following methods return the value of the corresponding field from "stat" in perlfunc: dev inode mode num_links uid gid rdev size atime mtime ctime blk_size blocks For example: my $file_size = $object->size; my $modified = $object->mtime; If any error occured during the previous "scan" it may be retrieved like this: my $last_error = $obj->error; It is not an error for the file being monitored not to exist. Finally if a directory is being monitored and the "files" or "recurse" option was specified the list of files in the directory may be retrieved like this: my @contained_files = $obj->files; If "files" was specified this will return the files and directories immediately below the monitored directory but not the contents of any subdirectories. If "recurse" was specified the entire directory tree below this directory will be returned. In either case the returned filenames will be complete absolute paths. Caveat for DirectoriesNote that "File::Monitor::Object" has no magical way to quickly perform a recursive scan of a directory. If you point it at a directory containing 1,000,000 files and specify the "recurse" option directory scans will take a long time.INTERFACE
Other AccessorsIn addition to the above the following methods may be called to return the value of the corresponding field from "stat" in perlfunc:dev inode mode num_links uid gid rdev size atime mtime ctime blk_size blocks For example: my $inode = $obj->inode; Check the documentation for "stat" in perlfunc to discover which fields are valid on your platform. DIAGNOSTICS
CONFIGURATION AND ENVIRONMENTFile::Monitor::Object requires no configuration files or environment variables.DEPENDENCIESNone.INCOMPATIBILITIESNone reported.BUGS AND LIMITATIONSNo bugs have been reported.Please report any bugs or feature requests to "bug-file-monitor@rt.cpan.org", or through the web interface at <http://rt.cpan.org>. AUTHORAndy Armstrong "<andy@hexten.net>"Faycal Chraibi originally registered the File::Monitor namespace and then kindly handed it to me. LICENCE AND COPYRIGHTCopyright (c) 2007, Andy Armstrong "<andy@hexten.net>". All rights reserved.This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic. DISCLAIMER OF WARRANTYBECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Visit the GSP FreeBSD Man Page Interface. |