
実弾発射と姿勢制御可能なUSB接続ミサイルランチャー発売という物が発売されておりますが、これをPlaggerのNotifyとして使おうというプラグインです。
Ejectの動きだけじゃ気づかないよ!って人におすすめです。
package Plagger::Plugin::Notify::MissileLauncher;動作イメージ
use strict;
use base qw( Plagger::Plugin );use Device::USB::MissileLauncher;
sub register {
my($self, $context) = @_;
$context->register_hook(
$self,
'publish.feed' => \&update,
'publish.finalize' => \&finalize,
);
$self->{count} = 0;
}sub update {
my($self, $context, $args) = @_;
$self->{count}++ if $args->{feed}->count;
}sub finalize {
my($self, $context, $args) = @_;
$self->fire if $self->{count};
}sub fire {
my $self = shift;
my $ml = Device::USB::MissileLauncher->new;
$ml->do($_) for @{ $self->conf->{command} };
$ml->do('fire');
}1;
__END__
=head1 NAME
Plagger::Plugin::Notify::MissileLauncher - Notify feed updates to Missile
=head1 SYNOPSIS
- module: Notify::MissileLauncher
=head1 AUTHOR
Kazuhiro Osawa
=head1 SEE ALSO
L<Plagger>, L<Device::USB::MissileLauncher>
=cut