NAME
App::MonM::Notifier::Channel::Script - monotifier script channel
VERSION
Version 1.00
SYNOPSIS
use App::MonM::Notifier::Channel;
# Create channel object
my $channel = new App::MonM::Notifier::Channel;
# Send message via file channel
$channel->script(
{
id => 1,
to => "anonymous",
from => "sender",
subject => "Test message",
message => "Content of the message",
headers => {
"X-Foo" => "Extended eXtra value",
},
},
{
encoding => 'base64', # Default: 8bit
content_type => undef, # Default: text/plain
charset => undef, # Default: utf-8
script => '/usr/bin/script.pl', # Default: none
}) or warn( $channel->error );
# See error
print $channel->error unless $channel->status;
DESCRIPTION
This module provides "script" method that send the content of the message to an external program
my $status = $channel->script( $data, $options );
The $data structure (hashref) describes body of message, the $options structure (hashref) describes parameters of the connection via external modules
DATA
It is a structure (hash), that can contain the following fields:
- id
-
Contains internal ID of the message. This ID is converted to an X-Id header
- to
-
Recipient address or name
- from
-
Sender address or name
- subject
-
Subject of the message
- message
-
Body of the message
- headers
-
Optional field. Contains eXtra headers (extension headers). For example:
headers => { "bcc" => "bcc\@example.com", "X-Mailer" => "My mailer", }
OPTIONS
It is a structure (hash), that can contain the following fields:
- script
-
Defines full path to external program
Default: none
About other options (base) see "OPTIONS" in App::MonM::Notifier::Channel
METHODS
- init
-
For internal use only!
Called from base class. Returns initialize structure
- handler
-
For internal use only!
Called from base class. Returns status of the operation
EXAMPLE
Script example:
#!/usr/bin/perl -w
use strict;
use utf8;
my @in;
while(<>) {
chomp;
push @in, $_;
}
print join "\n", @in;
exit;
HISTORY
See CHANGES
file
DEPENDENCIES
TO DO
See TODO
file
BUGS
* none noted
SEE ALSO
App::MonM::Notifier, App::MonM::Notifier::Channel
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