App::MonM::Notifier::Client - monotifier client
Version 1.00
use App::MonM::Notifier::Client; my $client = new App::MonM::Notifier::Client( url => "http://localhost/monotifier" ); my $client = new App::MonM::Notifier::Client( uri => $uri, debug => 1, verbose => 1, timeout => 180, # default: 180 ); my $status = $client->check; if ($status) { debug("OK $url: ".$client->code); debug(Dumper($client->res)); } else { debug("ERROR $url: ".$client->code); debug($client->error); }
Client for interaction with MToken server. This module provides client methods
The module based on MToken::Client.
my $client = new App::MonM::Notifier::Client( url => "http://localhost/monotifier", user => $user, # optional password => $password, # optional timeout => $timeout, # default: 180 );
Returns client
my $status = $client->check; my $status = $client->check( "GET" ); # Default: HEAD
Returns check-status of server. 0 - Error; 1 - Ok
See README file for details of data format
my $code = $client->code;
Returns HTTP code of the response
$client->credentials("username", "password", "realm")
Set credentials for User Agent by Realm (name of basic authentication)
print $client->error;
Returns error string
my %rec = $client->info( $token, $id );
Returns record by ID
my $request = $client->req;
Returns request hash
my $json = $client->request("METHOD", "PATH", "DATA");
Send request
my $response = $client->res;
Returns response hash
my $status = $client->status;
Returns object status value. 0 - Error; 1 - Ok
my $id = $client->send( token => $params{token}, ident => $params{ident}, level => $params{level}, to => $params{to}, from => $params{from}, subject => $params{subject}, message => $params{message}, pubdate => $params{pubdate}, expires => $params{expires}, );
Send message and returns ID or false
my $status = $client->remove( $token, $id );
Removes message by ID and returns status. 0 - Error; 1 - Ok
my $status = $client->send( id => $params{id}, token => $params{token}, ident => $params{ident}, level => $params{level}, to => $params{to}, from => $params{from}, subject => $params{subject}, message => $params{message}, pubdate => $params{pubdate}, expires => $params{expires}, );
Update message and returns status
my $trace_array = $client->trace; $client->trace("New trace record");
Gets trace stack or pushes new trace record to trace stack
$client->cleanuptrace;
Cleanup trace and returns client object
See CHANGES file
CHANGES
CTK, LWP
See TODO file
TODO
* none noted
App::MonM::Notifier, MToken::Client
Sergey Lepenkov (Serz Minus) http://www.serzik.com <abalama@cpan.org>
Copyright (C) 1998-2017 D&D Corporation. All Rights Reserved
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
LICENSE
To install App::MonM::Notifier, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::MonM::Notifier
CPAN shell
perl -MCPAN -e shell install App::MonM::Notifier
For more information on module installation, please visit the detailed CPAN module installation guide.