NAME

Power::Outlet::Common - Power::Outlet base class for all power outlets

SYNOPSIS

use base qw{Power::Outlet::Common};

DESCRIPTION

Power::Outlet::Common is a base class for controlling and querying a power outlets.

USAGE

use base qw{Power::Outlet::Common};

CONSTRUCTOR

new

METHODS

action

Smart case insensitive text-based wrapper around methods 0|ON => on, 1|OFF => off, SWITCH|TOGGLE => switch, CYCLE => cycle, QUERY => query

my $state = $outlet->action("on");
my $state = $outlet->action("1");
my $state = $outlet->action("off");
my $state = $outlet->action("0");
my $state = $outlet->action("switch");
my $state = $outlet->action("toggle");

query

The query method must be overridden in the sub class.

my $state = $outlet->query;  #returns ON|OFF Note: may return other values for edge case

on

The on method must be overridden in the sub class.

my $state = $outlet->on;   #turns the outlet on reguardless of current state and returns ON.

Note: This should cancel any non-blocking cycle requests

off

The off method must be overridden in the sub class.

my $state = $outlet->off;   #turns the outlet off reguardless of current state and returns OFF.

Note: This should cancel any non-blocking cycle requests

switch

Only override the switch method if your hardware natively supports this capability. However, it should still be documented.

my $state = $outlet->switch; #turns the outlet off if on and on if off and returns the final state ON|OFF.

Note: The default implementations does not cancel non-blocking cycle requests

cycle

Only override the cycle method if your hardware natively supports this capability. However, it should still be documented.

my $state = $outlet->cycle; #turns the outlet off-on-off or on-off-on with a delay and returns the final state ON|OFF.

Note: Implementations may be blocking or non-blocking.

cycle_duration

Override the cycle_duration method if you want.

Default; 10 seconds (floating point number)

name

User friendly name for an outlet.

BUGS

Please log on RT and send an email to the author.

SUPPORT

DavisNetworks.com supports all Perl applications including this package.

AUTHOR

Michael R. Davis
CPAN ID: MRDVT
DavisNetworks.com

COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO