user1952312
user1952312

Reputation: 258

how to implement a keyboard listeners or action listeners in Perl

Im working on my final project in Perl. I'm creating an ASCII arcade game that will be ran through terminal. One of the specifications for the project is that our code must be able to run on the school's Linux boxes. Students do not have sudo privileges within the linux evironment so installing modules like Term::ReadKey or Curses would be tricky if not a impossible due to all of there dependency and requirements. So I'm looking for an solution within perl standard libraries or maybe someother work around. Thanks!

Upvotes: 0

Views: 288

Answers (2)

ashley
ashley

Reputation: 566

Or perlbrew (http://perlbrew.pl/) if you have access to build tools.

Another workaround would be to use the core Unix Perl IO support. e.g. select (perldoc -f select), to do non-blocking keyboard scanning (or set a timeout). That's how I wrote a tetris clone in Unix/C 25 year ago :)

Upvotes: 0

Miguel Prz
Miguel Prz

Reputation: 13792

If you cannot use sudo, local::lib may be your friend, so you can install modules in your home directory, and no sudo is required.

With local::lib, you can install via cpan the modules you need, like Term::ReadKey.

Upvotes: 3

Related Questions