AHA
view release on metacpan or search on metacpan
example/lava_lamp.pl view on Meta::CPAN
my $password = shift;
my $user = shift;
my $aha = new AHA($host,$password,$user);
my $switch = new AHA::Switch($aha,$name);
my $self = {
aha => $aha,
switch => $switch
};
return bless $self,$class;
}
sub is_on {
shift->{switch}->is_on();
}
sub on {
shift->{switch}->on();
}
}
die "No host given" unless $self->{host};
die "No password given" unless $self->{password};
my $base = $self->{port} ? $self->{host} . ":" . $self->{port} : $self->{host};
$self->{ua} = LWP::UserAgent->new;
$self->{login_url} = "http://" . $base . "/login_sid.lua";
$self->{ws_url} = "http://" . $base . "/webservices/homeautoswitch.lua";
$self->{ain_map} = {};
return bless $self,$class;
}
=item $switches = $aha->list()
List all switches know to AHA. An arrayref with L<AHA::Switch> objects is
returned, one for each device. When no switch is registered an empty arrayref
is returned.
=cut
lib/AHA/Switch.pm view on Meta::CPAN
=cut
sub new {
my $class = shift;
my $aha = shift;
my $self = {
aha => $aha,
ain => $aha->_ain(shift)
};
return bless $self,$class;
}
=item $ain = $switch->ain()
Get the AIN which this object represents.
=cut
sub ain {
return shift->{ain};
( run in 0.654 second using v1.01-cache-2.11-cpan-4505f990765 )