2006年11月27日

実弾発射と姿勢制御可能な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

動作イメージ

Posted by Yappo at 2006年11月27日 17:44 | TrackBack | Perl
Comments
Post a comment









Remember personal info?






コメントを投稿する前に↓の場所にnospamと入力してください。