When polling events using the Perl module "Linux::Input", the default output gets shifted to something else. This results in problems when redirecting the output of this script.
Example:
Code: Select all
#!/usr/bin/perl
use Linux::Input::Joystick;
my $js = Linux::Input::Joystick->new("/dev/js0");
while (1) {
my @event = $js->poll(0.01);
printf("ding dong\n");
}
Code: Select all
$> ./myscript.pl
Code: Select all
$> ./myscript.pl > test.txt
[SOLUTION]
According to a friend of mine, the "selector" in "Linux::Input" shifts the default output to something else during polling, but doesn't set it back.
Code: Select all
#!/usr/bin/perl
use Linux::Input::Joystick;
my $js = Linux::Input::Joystick->new("/dev/js0");
while (1) {
my @event = $js->poll(0.01);
printf STDOUT "ding dong\n";
}
NOTE: Actually, I'm not really sure if that's a bug in Linux::Input or not.