Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

Hardware::UPS::Perl::Driver
package of methods to load a Hardware::UPS::Perl driver.

Hardware::UPS::Perl::Driver - package of methods to load a Hardware::UPS::Perl driver.



NAME

Hardware::UPS::Perl::Driver - package of methods to load a Hardware::UPS::Perl driver.


SYNOPSIS


    use Hardware::UPS::Perl::Driver;

    $driver = Hardware::UPS::Perl::Driver->new({

        Driver  => Megatec,

        Options => \%options,

        Logger  => $Logger,

    });

    $ups = $driver->getDriverHandle();

    $driver = Hardware::UPS::Perl::Driver->new();

    $driver->setDriverOptions(\@options);

    $driver->setLogger($Logger);

    $driver->setDriverHandle("Megatec");

    $ups = $driver->getDriverHandle();


DESCRIPTION

Hardware::UPS::Perl::Driver provides methods to load a Hardware::UPS::Perl driver into the namespace of the calling script.


LIST OF METHODS

new

Name:
new - creates a new driver object

Synopsis:

    $driver = Hardware::UPS::Perl::Driver->new();

    $driver = Hardware::UPS::Perl::Driver->new({

        Driver  => $driverName,

        Options => \%driverOptions,

        Logger  => $Logger,

    });
Description:
new initializes driver object used to load an existing Hardware::UPS::Perl driver, i.e. a package below Hardware::UPS::Perl::Driver, into the namespace of the calling script.

new expects the options as an anonymous hash.

Arguments:
Driver => $driverName
optional; string; the name of the UPS driver to load; the name is case-insensitive.

Options => \%driverOptions
optional; anonymous hash; the options passed on to the driver to load.

Logger => $logger
optional; a Hardware::UPS::Perl::Logging object; defines a logger; if not specified, a logger sending its output to STDERR is created.

See Also:
getDriverHandle, getDriverOptions, getLogger, setDriverHandle, setDriverOptions, setLogger

setLogger

Name:
setLogger - sets the logger to use

Synopsis:

    $driver = Hardware::UPS::Perl::Driver->new();

    $driver->setLogger($logger);
Description:
setLogger sets the logger object used for logging. setLogger returns the previous logger used.

Arguments:
$logger
required; a Hardware::UPS::Perl:Logging object; defines the logger for logging.

See Also:
new, getLogger

getLogger

Name:
getLogger - gets the current logger for logging

Synopsis:

    $driver = Hardware::UPS::Perl::Driver->new();

    $logger = $driver->getLogger();
Description:
getLogger returns the current logger, a Hardware::UPS::Perl::Logging object used for logging, if defined, undef otherwise.

See Also:
new, setLogger

setDriverOptions

Name:
setDriverOptions - sets the driver options for a new driver

Synopsis:

    $driver = Hardware::UPS::Perl::Driver->new();

    $driver->setDriverOptions(\%driverOptions);
Description:
setDriverOptions sets the options of the driver. setDriveroptions returns an anonymous hash of the driver options previously used. The driver options are not promoted to the current driver so far.

Arguments:
\%driverOptions
required; an anonymous hash; defines the options used to create a new driver object.

See Also:
new, getDriverHandle, getDriverOptions, setDriverHandle

getDriverOptions

Name:
getDriverOptions - gets the driver options for a new driver

Synopsis:

    $driver = Hardware::UPS::Perl::Driver->new();

    $driver->getDriverOptions();
Description:
getDriverOptions returns the options, an anonymous hash, currently used for the driver.

See Also:
new, getDriverHandle, setDriverHandle, setDriverOptions

setDriverHandle

Name:
setDriverHandle - sets the UPS driver handle

Synopsis:

    $driver = Hardware::UPS::Perl::Driver->new();

    $driver->setDriverOptions(\%driverOptions);

    $driver->setDriverHandle("Megatec");
Description:
setDriverHandle sets the UPS driver handle, i.e. defines the driver package below Hardware::UPS::Perl::Driver. It returns 1 on success, and 0, if something went wrong setting the internal error message.

Arguments:
$driver
required; string; the case-insensitive name of the UPS driver, i.e. it defines the driver package Hardware::UPS::Perl::Driver::$driver to use to deal with the UPS.

See Also:
new, getDriverHandle, getDriverOptions, getErrorMessage

getDriverHandle

Name:
getDriverHandle - gets the UPS driver handle

Synopsis:

    $driver = Hardware::UPS::Perl::Driver->new();

    $driver->setDriverOptions(\@driverOptions);

    $driver->setDriverHandle("Megatec");

    # a Hardware::UPS::Perl:Driver::Megatec object

    $ups = $driver->getDriverHandle();

    $driver = Hardware::UPS::Perl::Driver->new({

        Driver  => "Megatec",

        Options => \%driverOptions,

    });

    # a Hardware::UPS::Perl:Driver::Megatec object

    $ups = $driver->getDriverHandle();
Description:
getDriver returns the current UPS driver handle, i.e. it loads the object required to deal with the UPS into the namespace of the calling script.

See Also:
new, getDriverOptions, setDriverHandle, setDriverOptions

getErrorMessage

Name:
getErrorMessage - gets the internal error message

Synopsis:

    $driver = Hardware::UPS::Perl::Driver->new();

    unless ($driver->setDriver("Megatec")) {

        print STDERR $driver->getErrorMessage(), "\n";

        exit 1;

    }
Description:
getErrorMessage returns the internal error message, if something went wrong.


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::Megatec(3pm), Hardware::UPS::Perl::General(3pm), Hardware::UPS::Perl::Logging(3pm), Hardware::UPS::Perl::PID(3pm), Hardware::UPS::Perl::Utils(3pm)


NOTES

Hardware::UPS::Perl::Driver was inspired by the Perl5 extension package DBI.

Another great resource was the Network UPS Tools site, which can be found at


    http://www.networkupstools.org

Hardware::UPS::Perl::Driver was developed using perl 5.8.8 on a SuSE 10.1 Linux distribution.


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::Driver 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.

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy