NAME

App::MonM::Channel - The MonM channel class

VERSION

Version 1.00

SYNOPSIS

use App::MonM::Channel;

DESCRIPTION

This module provides channel base methods

new

my $channel = App::MonM::Notifier::Channel->new;

Returns the channel object

chconf

my $channel_conf = $channel->chconf;

Returns current channel config structure

cleanup

my $self = $channel->cleanup;

Cleaning up of working variables

error

my $error = $channel->error;
my $error = $channel->error( "New error" );

Sets/gets error message

message

my $email = $channel->message;
my $email = $channel->message( App::MonM::Message->new );

Gets/sets the App::MonM::Message object

type

my $type = $channel->type;
my $type = $channel->type( "File" );

Gets/sets the type value

sendmsg

my $status = $channel->sendmsg( $message, $chconf )
    or die($channel->error);

This method runs process of sending message to channel and returns operation status.

scheduler

my $scheduler = $channel->scheduler;

Returns App::MonM::Util::Sheduler object

$message

The App::MonM::Message object

$chconf

Channel config structure (hash)

CONFIGURATION DIRECTIVES

General configuration options (directives) detailed describes in "GENERAL DIRECTIVES" in App::MonM

The channel configuration directives are specified in named sections <channel NAME> where NAME is the name of the channel section. The NAME is REQUIRED attribute. For example:

<Channel SendMail>
    Type    Email
    Enable  on
    From    to@example.com
    From    from@example.com
</Channel>

Each the channel section can contain the following basic directives:

At
At Sun-Sat[00:00-23:59]
At Sun[6:30-12:00,14-20:30];Mon[7:00-20:30];Tue-Thu[9:00-17:00];Fri-Sat[off]

This directive describes the notification schedule. Notification schedule allows you to schedule time intervals for sending different types of notification to end recipients. Intervals can be specified based the channel level (<Channel NAME> sections) or user level (<User NAME> sections). For defining the days of the week in which the schedule is active use a directive At. The At directive consists of blocks separated by semicolons in the format:

Weekday[interval]
Weekday[interval,interval,...]
Weekday-Weekday[interval,interval,...]

The "Weekday" should be defined as a name of the day of the week in full or abbreviated form:

Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
Sun, Mon, Tue, Wed, Thu, Fri, Sat

Define how you want to use a schedule. If you want to activate a notification template only during specific time spans you have the option to combine recurring days of the week into daily intervals by defining the week interval for these days. You can unite several days into block for repetitive notification use according to the appointed block settings. In this case Days of the week should be separating them with "-" character, for example, "Sun-Sat" (all days from Sunday to Saturdays inclusive), or "Mon-Sun" (all days from Monday to Sunday inclusive). If some day of the week is omitted, then this day is automatically excluded from the notification schedule

The "Interval" is the Time intervals. To define the hours of the day in which the schedule is active use an Interval. Time intervals should be written in the form: hh:mm-hh:mm, for example:

00:00-10:00
12-14:50
15-16

If interval is not specified, interval 00:00-23:59 would be applied by default. You can use the "off" (or "none", "-") value to disable selected day of shedule. When the time will set as a 00:00-00:00 - it will lead to cancel all notifications for the day

Please, note: If the At directive is not specified the check scheduling will be disabled and the end user will receive messages at any time of the day and day of the week. The same effect will have setting of the value of the At directive as Sun-Sat[00:00-23:59]

Default: Sun-Sat[00:00-23:59]

Attachment
<Attachment>
    Filename    payment.pdf
    Type        application/pdf
    Encoding    base64
    Disposition attachment
    Path        /tmp/payment.pdf
</Attachment>

Section (sections) that defines attachments for each message

Default: no attachments

See also Email::MIME

BasedOn
BasedOn SendMail

Sets name of the common channel (not user channel) for loading directives from it

Charset

Sets the charset

Default: utf-8

See also Email::MIME

ContentType

Sets the content type

Default: text/plain

See also Email::MIME

Enable
Enable  yes

The main switcher of the channel section

Default: no

Encoding

Sets encoding (8bit, base64, quoted-printable)

Default: 8bit

See also Email::MIME

Headers
<Headers>
    X-Foo foo
    X-Bar bar
</Headers>

Container for MIME headers definitions

Type

Defines type of channel

Allowed types: File, Command, Email

The "Email" channel directives are describes in "CONFIGURATION DIRECTIVES" in App::MonM::Channel::Email, the "Command" channel directives are describes in "CONFIGURATION DIRECTIVES" in App::MonM::Channel::Command, the "File" channel directives are describes in "CONFIGURATION DIRECTIVES" in App::MonM::Channel::File

HISTORY

See Changes file

TO DO

See TODO file

SEE ALSO

Email::MIME

AUTHOR

Serż Minus (Sergey Lepenkov) https://www.serzik.com <abalama@cpan.org>

COPYRIGHT

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

LICENSE

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/