我只字不提,试图接受投入,不阻挡,不重复所接触的特性(文字是产出,我想有骑手改变行为)。
我远未使用。
use Term::ReadKey;
ReadMode( "cbreak", STDIN );
if($input = ReadKey($pause_time, STDIN)){
#process input
}
但是,一旦用户类型发生变化,文字就停止使用,直到新线进入。 我喜欢将处理的意见,而不等待新路线。
我只字不提,试图接受投入,不阻挡,不重复所接触的特性(文字是产出,我想有骑手改变行为)。
我远未使用。
use Term::ReadKey;
ReadMode( "cbreak", STDIN );
if($input = ReadKey($pause_time, STDIN)){
#process input
}
但是,一旦用户类型发生变化,文字就停止使用,直到新线进入。 我喜欢将处理的意见,而不等待新路线。
这是一项小型方案,我认为你希望:
#!/usr/bin/perl
use strict;
use warnings;
use Term::ReadKey;
ReadMode 4;
END { ReadMode 0 }
print <<EOS;
q to quit
b to print in binary
o to print in octal
d to print in decimal
x to print in hexadecimal
EOS
my $control = "d";
my $i = 0;
while (1) {
#use "if" if you want to have a buffer of commands
#that will be processed one per second
while (defined (my $key = ReadKey(-1))) {
exit 0 if $key eq q ;
$control = $key if $key =~ /^[bodx]$/;
}
printf "%$control
", $i++;
sleep 1;
}
我将把这一意见留给你自己回答,但决定我需要更多的余地。
破碎相当于原产物,但这种破碎的异构体的阻截控制序列,如 c、 c等。 两者同时收集特性。 这两种方式之间的行为差别,是你问题的根源。 如果Chas的解决方案与你打算做些什么一样,那么问题就更可能与你在<代码>上重复做的任何事情有关。 我已经评论过,如果我以某种精干的udi来填补,那么你原来的文字就会被罚款,这样我就可以看到它的工作。 例如,小范围插手:
use strict;
use warnings;
use Term::ReadKey;
my ($char, $input, $pause_time);
ReadMode("cbreak");
# Collect all characters typed into $input
# and quit when # is typed.
$input = ;
while ($char = ReadKey($pause_time)) {
last if $char eq # ;
$input .= $char;
}
print "$input
";
我无需打到底部,这样做是徒劳无益的(除了将运输回落到<条码>(投放到<条码>>/条码>之外,还绕过了航架)。
I am building a Web interface to monitor an embedded system. I have built a Perl script which runs remote commands and gathers output from that system. Now what I need is a Web interface which makes ...
How do I tell what type of value is in a Perl variable? $x might be a scalar, a ref to an array or a ref to a hash (or maybe other things).
When I try a "chdir" with a filehandle as argument, "chdir" returns 0 and a pwd returns still the same directory. Should that be so? I tried this, because in the documentation to chdir I found: "...
I ve read the doc for GetOptions but I can t seem to find what I need... (maybe I am blind) What I want to do is to parse command line like this myperlscript.pl -mode [sth] [inputfile] I can use ...
I m a little confused about what is going on in Perl constructors. I found these two examples perldoc perlbot. package Foo; #In Perl, the constructor is just a subroutine called new. sub new { #I ...
I would like to submit a form to a CGI script localy (w3c-markup-validator), but it is too slow using curl and apache, I want to use this CGI script more than 5,000 times in an another script. and ...
So I m running perl 5.10 on a core 2 duo macbook pro compiled with threading support: usethreads=define, useithreads=define. I ve got a simple script to read 4 gzipped files containing aroud 750000 ...
A Google search yields a number of results - but which ones are the best? The Perl site appears to contain two - perlboot and perltoot. I m reading these now, but what else is out there? Note: I ve ...