App::MonM::Store - DBI interface for checkit's data storing
Version 1.00
use App::MonM::Store; my $dbi = new App::MonM::Store( dsn => "DBI:mysql:database=monm;host=mysql.example.com", user => "username", password => "password", set => [ "RaiseError 0", "PrintError 0", "mysql_enable_utf8 1", ], ); print STDERR $dbi->error if $dbi->error;
DBI interface for checkit's data storing
my $dbi = new App::MonM::Store( dsn => "DBI:mysql:database=monm;host=mysql.example.com", user => "username", password => "password", set => [ "RaiseError 0", "PrintError 0", "mysql_enable_utf8 1", ], );
Creates DBI object
$dbi->add( name => "foo", type => "http", source => "http://example.com", status => 1, message => "Ok" ) or die $dbi->error;
Add new record on database
$dbi->clean( period => 600 ) or die $dbi->error;
Delete too old records from database
$dbi->del( id => 1 ) or die $dbi->error;
Delete record from database
my $dsn = $dbi->dsn;
Returns DSN string of current database connection
my $error = $dbi->error; $dbi->error("Error message");
Gets/sets error string
my %info = $dbi->get( name => "foo" );
Gets information about file from database
Format:
{ id => 1, time => 123456789, name => "foo" type => "http", source => "http://example.com" status => 1, message => "Ok" }
The Record ID. Autoincremented value!
The checking message
Name of checkit section
Source Name: URL, DSN or command
Status of checking: 000-111 as binary notation
Default: 0
Time of record insert
Default: time()
Type of checkit source: http, dbi, command
Default: http
print $dbi->is_sqlite ? "Is SQLite" : "Is not SQLite"
Returns true if type of current database is SQLite
my @files = $dbi->getall();
Returns list of all checkit values
Record format of return result: see "get"
$dbi->set( id => 1, name => "foo", type => "http", source => "http://example.com", status => 1, message => "Ok" ) or die $dbi->error;
Update existing record on database
App::MonM, CTK::DBI
Serż Minus (Sergey Lepenkov) http://www.serzik.com <abalama@cpan.org>
Copyright (C) 1998-2019 D&D Corporation. All Rights Reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See LICENSE file and https://dev.perl.org/licenses/
LICENSE
To install App::MonM, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::MonM
CPAN shell
perl -MCPAN -e shell install App::MonM
For more information on module installation, please visit the detailed CPAN module installation guide.