The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

App::MonM::Notifier::Store - monotifier store class

VERSION

Version 1.00

SYNOPSIS

    use App::MonM::Notifier::Store;

    my $store = new App::MonM::Notifier::Store;

DESCRIPTION

This module provides store methods.

For internal use only

METHODS

new

Constructor

status
    my $status = $store->status;
    my $status = $store->status( 1 ); # Sets the status value and returns it

Get/set BOOL status of the operation

error
    my $error = $store->error;

Returns error message

    my $status = $store->error( "Error message" );

Sets error message if argument is provided. This method in "set" context returns status of the operation as status() method.

add
    my $newid = $store->add(
        ip      => LOCALHOSTIP,
        host    => hostname,
        ident   => "quux",
        level   => getLevelByName("error"),
        to      => "test",
        from    => "test",
        subject => "Test message",
        message => "Content",
        pubdate => time() + 60*5,
        expires => 60*5 + 60*60*24,
        status  => "NEW",
    );

This method adds new record into store. Returns ID created record

get
    my %data = $store->get( $id );

This method gets record from store. Returns hash of this record

getall
    my @table = $store->getall( id => $id );
    my @table = $store->getall(
            id      => $id, # Integer value
            ip      => $ip, # IPv4 value
            host    => $host,
            ident   => $ident,
            level   => $level, # Integer value
            to      => $to,
            from    => $from,
            status  => $status, # String value
            errcode => $errcode, # Integer value
        );

This method returns all records from store by criteria. Returns array-ref

getJob
    my %data = $store->getJob;

This method gets record as new job from store for processing. Returns hash of this record

setJob
    $store->setJob(
            id      => $id,
            status  => $status,
            errcode => $errcode,
            errmsg  => $errmsg,
            comment => "... comment ...",
            # ... other fields ...
        );

This method sets the new data for the record by record id

ping
    $store->ping ? 'OK' : 'Database session is expired';

Checks the connection to database

del
    my $status = $store->del( $id );

This method removes record in store. Returns status

set
    $store->set(
            id      => $id,
            status  => $status,
            errcode => $errcode,
            errmsg  => $errmsg,
            comment => "... comment ...",
            # ... other fields ...
        );

This method sets the new data for the record by record id

HISTORY

See CHANGES file

DEPENDENCIES

CTK, DBI

TO DO

See TODO file

BUGS

* none noted

SEE ALSO

App::MonM::Notifier, App::MonM::AlertGrid

AUTHOR

Sergey Lepenkov (Serz Minus) http://www.serzik.com <abalama@cpan.org>

COPYRIGHT

Copyright (C) 1998-2017 D&D Corporation. All Rights Reserved

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.

See LICENSE file