Here's my Perl script:
#!/usr/bin/perl
use Term::ReadLine;
# count lines in stdin (the mail message):
$n=0; while (<>) { $n++ }
print "$n lines\n";
my $term=new Term::ReadLine 'vpp';
$term->readline("type return to quit: ")
And here the test run:
$ echo test |readlineperl
1 lines
type return to quit:
$
Now the Ruby version:
#!/usr/bin/env ruby
require 'readline'
include Readline
# count lines in stdin (the mail message):
n=0; while gets: n+=1 end
puts "#{n} lines"
readline("type return to quit: ")
Its test run does not exit with a return - it needs ctrl-C:
$ echo test |readlineruby
1 lines
type return to quit:
./readlineruby:10:in `readline': Interrupt
from ./readlineruby:10
$
Is this a bug? Or a missing feature, like Readline.new?
--
Wybo
In message "Re: gnu readline ruby vs. perl"
on Fri, 10 Jun 2005 07:19:45 +0900, Wybo Dekker <wy...@servalys.nl> writes:
|I'm translating a Perl script into Ruby, but can't reproduce a readline
|action. I made two, hopefully equivalent, test scripts in Perl and Ruby,
|but they behave differently.
Ruby's readline takes input from stdin. Perhaps Perls takes from
/dev/tty, or something. Any information is welcome.
matz.
At Fri, 10 Jun 2005 07:19:45 +0900,
Wybo Dekker wrote in [ruby-talk:145011]:
> Its test run does not exit with a return - it needs ctrl-C:
>
> $ echo test |readlineruby
> 1 lines
> type return to quit:
> ./readlineruby:10:in `readline': Interrupt
> from ./readlineruby:10
> $
The test exited immediately after printing the prompt, on my box.
What are your platform, ruby and readline versions?
--
Nobu Nakada
I've experienced same problem with OP.
$ ldd /usr/lib/ruby/1.8/i686-linux/readline.so | grep readline
libreadline.so.4 => /lib/libreadline.so.4 (0xb7f00000)
$ ruby -v
ruby 1.8.2 (2004-12-25) [i686-linux]
Same on the 1.9 (March).
I had the same, both on ruby 1.8 and 1.9, but with libreadline.so.5
--
Wybo
At Sun, 12 Jun 2005 20:57:04 +0900,
Wybo Dekker wrote in [ruby-talk:145200]:
> > > The test exited immediately after printing the prompt, on my box.
> > > What are your platform, ruby and readline versions?
This was on cygwin.
> > I've experienced same problem with OP.
> >
> > $ ldd /usr/lib/ruby/1.8/i686-linux/readline.so | grep readline
> > libreadline.so.4 => /lib/libreadline.so.4 (0xb7f00000)
> > $ ruby -v
> > ruby 1.8.2 (2004-12-25) [i686-linux]
> >
> > Same on the 1.9 (March).
>
> I had the same, both on ruby 1.8 and 1.9, but with libreadline.so.5
Same on linux.
Seems depending on readline implementation.
--
Nobu Nakada
> > Somehow a file contains sequence number corrupted on 2005-12-15
> > 19:27:58 JST. I just restored.
>
> Old articles 1-112 were lost? Seems blade has lost them too.
Ugh... probably because they were "overwritten" by the mis-numbered
articles.
Hopefully someone has backups... I imagine they are rather
historically important...
-mental
> Quoting nobuyoshi nakada <nobuyosh...@ge.com>:
>
>>> Somehow a file contains sequence number corrupted on 2005-12-15
>>> 19:27:58 JST. I just restored.
>>
>> Old articles 1-112 were lost? Seems blade has lost them too.
>
> Hopefully someone has backups... I imagine they are rather
> historically important...
for the moment they are in the google cache...
I should have backups of all these articles. I can check when I get
home tonight.
Wayne
---
Wayne Vucenic
No Bugs Software
"Ruby and C++ Agile Contract Programming in Silicon Valley"
> Quoting nobuyoshi nakada <nobuyosh...@ge.com>:
>
>> > Somehow a file contains sequence number corrupted on 2005-12-15
>> > 19:27:58 JST. I just restored.
>>
>> Old articles 1-112 were lost? Seems blade has lost them too.
>
> Ugh... probably because they were "overwritten" by the mis-numbered
> articles.
oO(can this be exploited by faking the X-Mail-Count number?)
> Hopefully someone has backups... I imagine they are rather
> historically important...
>
> -mental
--
Christian Neukirchen <chneuk...@gmail.com> http://chneukirchen.org
> So long as this message doesn't have a Mail-Count of 10101010,
> we're OK.
Hmm. Now it's got TWO X-Mail-Count headers. That's not good.
Is there a reason for the listserv to preserve existing mail-count
headers?
-mental
> .oO(can this be exploited by faking the X-Mail-Count number?)
Possibly... it looks like the listserv doesn't strip existing
X-Mail-Counts, though it puts them second.
-mental
If anyone needs them to do the restore, I'll .zip them up and send them
to you.
Wayne