[Cascavel-pm] Hands-on via web
igor em izut.com
igor em izut.com
Sexta Abril 28 12:09:33 PDT 2006
Mais um.
<code>
#!/usr/bin/perl
use warnings;
use IO::Select;
use IO::Scalar;
use Term::ReadLine;
my $term = Term::ReadLine->new('Perl Interactive Interpreter');
my $prompt = '>> ';
my $data = '';
my $io = IO::Scalar->new(\$data);
while (defined($_ = $term->readline($prompt))) {
select($io);
my $res = eval ($_);
select(*STDOUT);
warn $@ if $@;
print $res, "\n" unless $@;
if ($data ne '') {
print $data, "\n";
$data = '';
}
$term->addhistory($_) if /\S/;
}
</code>
Igor.
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
Mais detalhes sobre a lista de discussão Cascavel-pm