Workflow-Inotify

 view release on metacpan or  search on metacpan

lib/Workflow/Inotify/Handler.pm  view on Meta::CPAN

creates accessors for all your configuration values.

=head2 new

 new( config, [app config] )

The class is instantiated by the C<inotify.pl> script and is passed a
L<Config::IniFiles> object. Override the C<handler()> or the C<new()>
method if you choose.

I<HINT>: You can add additional application specific values to the
configuration file and access their values using the
C<Config::IniFiles> object passed in the constructor.

 my $user_name = $self->get_config()->val(application => 'user_name');

I<BONUS>: If you add a section to the configuration file using the
canonical form (replace all ':: with '_') of your handler's name the
configuration variables defined in that section will be used by the
default C<new()> method to create accessors for each value. Accessors
are named using the best practice of separate setters and getters for
each value (e.g. C<get_foo()>, C<set_foo()>).

 [workflow_s3_uploader]
 bucket        = foo
 bucket_prefix = /biz
 region        = us-east-1
 host          = s3.amazonaws.com

...

 sub handler {
   my ($event) = @_;

   my $host = $self->get_host();
   ...
 }

=head1 INOTIFY EVENTS

I<....from C<man 7 inotify>...>

The inotify_add_watch(2) mask argument and the mask
field of the inotify_event structure returned when read(2)ing an
inotify file descriptor are both bit masks identifying inotify events.
The following bits can be specified in mask when calling
inotify_add_watch(2) and may be returned in the mask field returned by
read(2):

=over 

=item * IN_ACCESS (+)

File was accessed (e.g., read(2), execve(2)).

=item * IN_ATTRIB (*)

Metadata changed for example, permissions (e.g., chmod(2)), timestamps
(e.g., utimensat(2)), extended attributes (setxattr(2)), link count
(since Linux 2.6.25; e.g., for the target of link(2) and for
unlink(2)), and user/group ID (e.g., chown(2)).

=item * IN_CLOSE_WRITE (+)

File opened for writing was closed.

=item * IN_CLOSE_NOWRITE (*)

File or directory not opened for writing was closed.

=item * IN_CREATE (+)

File/directory created in watched directory (e.g., open(2) O_CREAT,
mkdir(2), link(2), symlink(2), bind(2) on a UNIX domain socket).

=item * IN_DELETE (+)

File/directory deleted from watched directory.

=item * IN_DELETE_SELF

Watched file/directory was itself deleted.  (This event also occurs if
an object is moved to another filesystem, since mv(1) in effect copies
the file to the other filesystem and then deletes it from the original
filesystem.)  In addition, an=item * IN_IGNORED event will
subsequently begenerated for the watch descriptor.

=item * IN_MODIFY (+)

File was modified (e.g., write(2), truncate(2)).

=item * IN_MOVE_SELF

Watched file/directory was itself moved.

=item * IN_MOVED_FROM (+)

Generated for the directory containing the old filename when a file is renamed.

=item * IN_MOVED_TO (+)

Generated for the directory containing the new filename when a file is renamed.

=item * IN_OPEN (*)

File or directory was opened.

=back

When monitoring a directory:

=over

=item * the events marked above with an asterisk (*) can occur both
for the directory itself and for objects inside the directory; and

=item * the events marked with a plus sign (+) occur only for objects
inside the directory (not for the directory itself).

=back



( run in 1.039 second using v1.01-cache-2.11-cpan-5511b514fd6 )