- PERSISTENT CONNECTIONS
- COPYRIGHT AND LICENSE
Transform::Alert::Output - Base role for Transform::Alert output types
This is the role used for all output types.
The Alert object that constructed it.
Hash ref of the connection options (from configuration).
Scalar ref of the output template.
All I/O types require the following methods below. Unless specified, all of the methods should report a true value on success or undef on error. The methods are responsible for their own error logging.
Called on every new interval, if
opened returns false. Most types would open up the connection here and run through any "pre-get/send" setup. Though, in the case of UDP, this isn't always necessary.
Must return a true value if the connection is currently open and valid, or false otherwise.
Be aware that outputs may potentially have this method called on each alert, since the group loop will only open the connection if it has something to send.
Called on each alert that successfully matched a Template and/or Munger.
This is the only method that passes any sort of data, which would be the output-rendered string ref, based that the data the input RE-based template acquired (or that the Munger mangled). The send operation should use these values to send the converted alert.
Called after the interval loop has been completed. This should close the connection and run through any cleanup.
This method should double-check all I/O cleanup with the
opened method to ensure that close doesn't fail. This is important if the loop detects that the
opened method is false, since it will try a
close before trying to re-open.
Persistent connections can be done by defining
close in such a way that it still keeps the connection online, and making sure
opened can handle the state. Take special care to check that the connection is indeed valid and the module can handle re-opens properly.
The project homepage is https://github.com/SineSwiper/Transform-Alert/wiki.
The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit http://www.perl.com/CPAN/ to find a CPAN site near you, or see https://metacpan.org/module/Transform::Alert/.
Brendan Byrd <BBYRD@CPAN.org>
This software is Copyright (c) 2013 by Brendan Byrd.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)