/usr/share/perl5/TWatch/Plugin.pm is in libtwatch-perl 0.0.7-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | package TWatch::Plugin;
=head1 NAME
TWatch::Plugin - Load and execute plugins
=cut
use strict;
use warnings;
use utf8;
use File::Basename qw(dirname);
use File::Path qw(make_path);
use base qw(Exporter);
our @EXPORT=qw(config DieDumper Dumper);
use TWatch::Config;
=head1 CONSTRUCTOR
=cut
=head2 new
=cut
sub new
{
my ($class, %opts) = @_;
my $self = bless \%opts ,$class;
return $self;
}
=head2 post
Execute post plugins.
=cut
sub post
{
my ($self, $twatch) = @_;
my @modules = glob(config->get('Plugin'));
for my $module ( @modules )
{
# Get plugin module name
s/^.*\/(.*?)\.pm$/$1/, s/^(.*)$/TWatch::Plugin::$1/ for $module;
# Load plugin
eval "require $module";
printf("Can`t load plugin \"%s\": %s\n", $module, $@), next if $@;
# Crape plugin object and set current cinfig
my $plugin = eval{ $module->new( config ) };
printf("Can`t create plugin \"%s\": %s\n", $module, $@), next
if $@ or !$plugin;
# Execute plugin with TWatch object
eval{ $plugin->run( $twatch ) };
printf("Can`t run plugin \"%s\": %s\n", $module, $@), next if $@;
}
}
1;
=head1 REQUESTS & BUGS
Roman V. Nikolaev <rshadow@rambler.ru>
=head1 AUTHORS
Copyright (C) 2008 Roman V. Nikolaev <rshadow@rambler.ru>
=head1 LICENSE
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>.
=cut
|