NAME

Device::USB::PanicButton - interface to USB Panic Button

SYNOPSIS

    use Device::USB::PanicButton;

    my $pbutton = Device::USB::PanicButton->new();

    if(!$pbutton || $pbutton->error()) {
        printf(STDERR "FATAL: ". $pbutton->error() ."\n");
        exit(-1);
    }

    while(1) {
        my $result = $pbutton->pressed();

        if($result == 1) {
            printf("PANIC ;)\n");
        } elsif($result < 0) {
            printf(STDERR "WARN: ". $pbutton->error() ."\n");
        }	

	sleep(1);
    }

DESCRIPTION

This implements a basic interface to the toy USB Panic Button by reading out the button status.

http://www.firebox.com/product/1742/USB-Panic-Button

It has three methods - new(), error() and pressed().

new() returns always an object - you have to check for errors with error().

error() returns a scalar with an error message, if something hit an error.

pressed() returns:

-1, if something went wrong during reading the device.
 0, if the button was not pressed.
 1, if the button was pressed since last read process.

REQUIREMENTS

libusb -> http://libusb.sourceforge.net
Device::USB -> http://search.cpan.org/search?query=Device-USB

AUTHOR

Benjamin Kendinibilir <bkendinibilir@mac.com>

COPYRIGHT

Copyright (C) 2008 by Benjamin Kendinibilir. All Rights Reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.

SEE ALSO

Device::USB