NAME
Hardware::UPS::Perl::General - general functions for Hardware::UPS::Perl scripts
SYNOPSIS
use Hardware::UPS::Perl::General;
&InitWE()
&Error("this is an error message");
&Warning("this is an warning message");
&ManPage();
&Version("1.1", "01-02-2007", "this is the description");
DESCRIPTION
Hardware::UPS::Perl::General provides general functions for Perl scripts dealing with an UPS.
VARIABLES
@EXPORT
FUNCTIONS
InitWE
- Name:
-
InitWE - main initializing function
- Synopsis:
-
&InitWE();
- Description:
-
InitWE sets up the signals to be catched so far only. This might change in a future release.
- See Also:
Catch
- Name:
-
Catch - signal catcher
- Synopsis:
-
&Catch($signal);
- Description:
-
Catch catches the signal
$signal
. In case of signal 'TERM' the script will be terminated regulary (status 0), while for signal 'HUP' the script will be restarted. In all other cases, the script will be terminated with status 1 by calling the function "Error". - Arguments:
- See Also:
Error
- Name:
-
Error - displays errors
- Synopsis:
-
&Error($errorMessage);
- Description:
-
Error writes the error message
$errorMessage
, a text string, to STDERR and exits with status 1. The error message is prepended by the basename of the calling script. - Arguments:
- See Also:
Warning
- Name:
-
Warning - displays warning messages
- Synopsis:
-
&Warning($warningMessage);
- Description:
-
Warning writes the warning message
$warningMessage
, a text string, to STDERR. The warning message is prepended by the basename of the calling script. - Arguments:
- See Also:
ManPage
- Name:
-
ManPage - displays embedded pod documentation
- Synopsis:
-
&ManPage();
- Description:
-
ManPage displays the embedded pod documentation of the calling script and exits without errors. It uses pod2man, groff and less as pager.
- See Also:
-
groff(1), less(1), pod2man(1)
Version
- Name:
-
Version - displaying version information
- Synopsis:
-
&Version($revisionVersion, $revisionDate, $description);
- Description:
-
Version displays the version information consisting of the revision version
$revisionVersion
, revision date$revisionDate
and the program description$description
together with a copyright statement of the calling script and exits without errors. - Arguments:
- See Also:
SetLogger
- Name:
-
SetLogger - sets the logger
- Synopsis:
-
&SetLogger($logger);
- Description:
-
SetLogger sets the logger to be used in the generalized signal handler Catch.
- Arguments:
- See Also:
SetPID
- Name:
-
SetPID - sets the PID object
- Synopsis:
-
&SetPID($pid);
- Description:
-
SetPID sets the PID object to be used in the generalized signal handler Catch.
- Arguments:
- See Also:
ConnectUPS
- Name:
-
ConnectUPS - connects to a UPS
- Synopsis:
-
my $ups = &ConnectUPS({ Host => $host, TCPPort => $Port DebugLevel => $DebugLevel, Driver => $Driver, Logger => $Logger, }); my $ups = &ConnectUPS({ SerialPort => $Port DebugLevel => $DebugLevel, Driver => $Driver, Logger => $Logger, });
- Description:
-
ConnectUPS returns an UPS object connected to a UPS.
ConnectUPS expects the options as an anonymous hash.
- Arguments:
-
Host => $host
-
optional; string; defines the remote host to connect to.
TCPPort => $tcpPort
-
required, if host is specified; natural number; defines the TCP port at the remote host to connect to.
SerialPort => $serialPort
-
required, if host is not specified; string; defines the serial port the UPS resides at.
DebugLevel => $debugLevel
-
optional; natural number; defines the debug level.
Driver => $driver
-
required; string; defines the UPS driver to use.
Logger => $logger
-
required; a Hardware::UPS::Perl::Logging object; defines a logger; if not specified, a logger sending its output to STDERR is created.
- See Also:
SEE ALSO
Hardware::UPS::Perl::Connection(3pm), Hardware::UPS::Perl::Connection::Net(3pm), Hardware::UPS::Perl::Connection::Serial(3pm), Hardware::UPS::Perl::Constants(3pm), Hardware::UPS::Perl::Driver(3pm), Hardware::UPS::Perl::Driver::Megatec(3pm), Hardware::UPS::Perl::Logging(3pm), Hardware::UPS::Perl::PID(3pm), Hardware::UPS::Perl::Utils(3pm)
BUGS
There are plenty of them for sure. Maybe the embedded pod documentation has to be revised a little bit.
Suggestions to improve Hardware::UPS::Perl::General are welcome, though due to the lack of time it might take a while to incorporate them.
AUTHOR
Copyright (c) 2007 by Christian Reile, <Christian.Reile@t-online.de>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. For further licensing details, please see the file COPYING in the distribution.