cleanup spaces around ; for params
[Printer-EVOLIS.git] / scripts / evolis-command.pl
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5
6 use Data::Dump qw(dump);
7 use Time::HiRes;
8 use Getopt::Long;
9 use Term::ReadLine;
10 use lib 'lib';
11 use Printer::EVOLIS::Parallel;
12
13 my $port = '/dev/usb/lp0';
14 my $debug = 0;
15
16 GetOptions(
17         'debug+' => \$debug,
18         'port=s' => \$port,
19 ) || die $!;
20
21 warn "# port $port debug $debug\n";
22
23 my $parallel = Printer::EVOLIS::Parallel->new( $port );
24
25 my $term = Term::ReadLine->new('EVOLIS');
26 my $OUT = $term->OUT || \*STDOUT;
27
28 select($OUT); $|=1;
29
30 while ( defined ( $_ = $term->readline('command> ')) ) {
31         chomp;
32         my $send = "\e$_\r";
33
34         my $response = $parallel->command( $send );
35
36         $term->addhistory($_) if $response;
37
38         print $OUT "<answer ",dump($response),"\n";
39
40 }
41