App::MonM::Notifier::Channel - monotifier channel base class
Version 1.00
use App::MonM::Notifier::Channel; my $channel = new App::MonM::Notifier::Channel( timeout => 300, # Default: 300 ); my $data = { id => 1, to => "recipient", from => "sender", subject => "Test message", message => "Content of the message", }; $channel->send( default => $data ) or warn($channel->error); # ...or... $channel->default( $data ) or warn($channel->error); # Run Email::MIME methods print $channel->{email}->body_str if $channel->status;
This module provides channel base methods
my $channel = new App::MonM::Notifier::Channel( timeout => 300, # Default: 300 );
Constructor
The "timeout" attribute is maximum time to run the channel process. Default: 300 secs
my $status = $channel->status; my $status = $channel->status( 1 ); # Sets the status value and returns it
Get/set BOOL status of the operation
my $error = $channel->error;
Gets error message
my $status = $channel->error( "Error message", "Trace dump" );
Sets error message and trace dump if second argument is provided. This method in "set" context returns status of the operation as status() method. See "trace" about tracing
my $trace = $channel->trace;
Gets trace message
my $timeout = $channel->timeout; # Sets the timeout value and returns it my $timeout = $channel->timeout( 500 );
Get/set timeout of the operation
my @available_channels = $channel->channels; my $available_channel = $channel->channels( "default" );
Returns list of available channels. To check the availability of the channel, you must specify its name as an argument
my $status = $channel->check( file => $data, $opts ) or warn($channel->error);
Runs validation of the data and options and returns status
my $status = $channel->send( default => $data, $opts ) or warn($channel->error); my $status = $channel->default( $data, $opts ) or warn($channel->error);
This method runs process of sending message to selected channel and returns status this operation.
For selecting the channel you must be provided name it as the first argument or call the method of the same name.
See "DATA" and "OPTIONS" for more details on data and options of method
Local default method that provides base process. See "send" method
It is a structure (hash), that can contain the following fields:
Contains internal ID of the message. This ID is converted to an X-Id header
Recipient address or name
Sender address or name
Subject of the message
Body of the message
Optional field. Contains eXtra headers (extension headers). For example:
headers => { "bcc" => "bcc\@example.com", "X-Mailer" => "My mailer", }
Encoding: 'quoted-printable', base64' or '8bit'
Default: 8bit
See Email::MIME
The content type
Default: text/plain
Part of common Content-Type attribute. Defines charset
Default: utf-8
This attribute defines method of the returned serialized data
my $ret; $channel->default( $data, {io => \$ret} );
Returns serialized data as scalar variable $ret
$channel->default( $data, {io => $fh} );
Returns serialized data to file by file handler (IO::File)
$channel->default( $data, {io => \*STDERR} );
Returns serialized data to STDERR pipe
$channel->default( $data, {io => IO::Pipe->new} );
Returns serialized data to custom pipe
$channel->default( $data, {io => 'NONE'} );
Returns serialized data to STDOUT
$channel->default( $data, {io => undef} );
No returns any serialized data! See email attrribute, get it via $channel->{email} access
Set/unset add signature to the message's body
See CHANGES file
CHANGES
CTK, Email::MIME
See TODO file
TODO
* none noted
App::MonM::Notifier, Email::MIME
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.