Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Recent Chamber Activity

2016-04-09
2016-04-08
  • 21:05: [PF/Files] Swatchdog-Actions-Perl-0.1.tar.gz has been deleted
  • 21:04: [PF/Files] File (DELETED) has been moved to (root)
  • 21:00: [PF/Files] File (DELETED) has been moved to archives
  • 21:00: [PF/Files] New folder has been created: archives

Recent Wiki Changes

2016-04-09

Wiki Guide

Side Bar

Swatchdog-Actions-Perl

Perl コードによる Swatchdog の柔軟なアクションのための基底クラス (Base class for flexible action of Swatchdog by perl code)

リリースファイル (Release Files)

FilenameSizeTimeDownload count
Swatchdog-Actions-Perl-0.1.tar.gz13.14 k2016-04-09 15:46:2440

Readme

NAME
    Swatchdog::Actions::Perl - perl object for Swatchdog action

INSTALLATION
    To install this module type the following:

       perl Makefile.PL
       make test
       sudo make install

SYNOPSIS
    In your perl module file:

        package Swatchdog::Actions::Perl::Login;
        use threads;
        use threads::shared;
        use Swatchdog::Actions::Perl;
    
        use vars qw(
            @ISA
            %TrustedUser
        );
    
        @ISA = qw(Swatchdog::Actions::Perl);
        %TrustedUser = ();
        share(%TrustedUser);
    
        sub new($@) {
            my $class = shift;
            my $self = Swatchdog::Actions::Perl->new(@_);
    
            bless $self, $class;
    
            return $self;
        }
    
        sub logEventOccurred($) {
            my $self    = shift;
    
            $self->logInfo('The use %s has logged in a %s manner from %s.',
                $self->{property}->{user},
                $self->{property}->{secure} ? 'secure' : 'non-secure',
                $self->{property}->{from}
            );
        }
    
        sub mustEventBeDealtWith($) {
            my $self = shift;
            my $value;
            $self->logTrace('BEGIN %s', (caller 0)[3]);
    
            $value =
                exists $TrustedUser{$self->{property}->{user}}
                    &&
                $self->{property}->{secure}
                ;
            $self->logInfo('The user %s from %s %s a trusted user.',
                $self->{property}->{user},
                $self->{property}->{from},
                $self->{property}->{secure} ? 'is' : "isn't"
            );
    
            $self->logTrace('END   %s', (caller 0)[3]);
            return $value;
        }
    
        sub dealWithEvent($) {
            my $self = shift;
            $self->logDebug('BEGIN %s', (caller 0)[3]);
    
            AddTrustedClientHost($self->{property}->{from});
    
            $self->logDebug('END   %s', (caller 0)[3]);
        }
    
        sub AddTrustedClientHost($) {
            # Do something.
        }

    In the configuration file of Swatchdog:

        perlcode 0 use Swatchdog::Actions::Perl::Login;
    
        perlcode 0 $Swatchdog::Actions::Perl::Login::TrustedUser{john} = 1;
        perlcode 0 $Swatchdog::Actions::Perl::Login::TrustedUser{mark} = 1;
        perlcode 0 $Swatchdog::Actions::Perl::Login::TrustedUser{becky} = 1;
        perlcode 0 my $Login = Swatchdog::Actions::Perl::Login->new();
        watchfor /^\w{3}\s+\d{1-2} \d{2}:\d{2}:\d{2} \S+ sshd\[\d+\]: Accepted publickey for (\w+) from: (\S+) port /
            perlcode 2 $Login->onEventOccurred(
            perlcode 2    user => $1, from => $2,
            perlcode 2    secure => 1
            perlcode 2 );

DESCRIPTION
    This module is a base class, which provides Swatchdog actions. In the
    configuration file of Swatchdog, to run a complex process in a exec
    action, you need to create a command. By using this module, you will be
    able to define the action in the perl code instead of the command.

VERSION
        0.1

AUTHOR
    Yuji Okamura <okamura[at]users.osdn.me>

COPYRIGHT
    Copyright (C) 2015 Yuji OKamura. All Rights Reserved.

    This module is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.

リポジトリ (Repository)

  • R/O
  • R/O (HTTP)
  • R/W (SSH)
  • R/W (HTTPS)
Fork

最近のコミット (Recent Commits)

Rev.TimeAuthorMessage RSS
7fc34baa2016-04-09 15:37:09Yuji OkamuraFixed the version.
a94bf8832016-04-09 15:09:48Yuji OkamuraPODs and etc. are modified.
8e18d90a2016-04-08 20:55:05Yuji Okamuraoriginal version

最近更新されたチケット (Latest updated Tickets)

No tickets