[27833] in Perl-Users-Digest
Perl-Users Digest, Issue: 9197 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 24 18:06:18 2006
Date: Mon, 24 Apr 2006 15:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 24 Apr 2006 Volume: 10 Number: 9197
Today's topics:
Re: "our" from XS and some other questions <nospam-abuse@ilyaz.org>
Re: How to remove all duplications of characters <rvtol+news@isolution.nl>
Re: Term::ReadKey on Win? 5.005 vs 5.8.8? <rvtol+news@isolution.nl>
Re: Term::ReadKey on Win? 5.005 vs 5.8.8? <nospam-abuse@ilyaz.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 24 Apr 2006 21:32:27 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: "our" from XS and some other questions
Message-Id: <e2jg5b$2721$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Ferry Bolhar
<bol@adv.magwien.gv.at>], who wrote in article <1145878924.988247@proxy.dienste.wien.at>:
> use MyTest;
>
> MyTest::init();
>
> print "MyTest result: $mytest\n";
As explained in another post, as posted situation is hopeless (due to
difference between run-time, and compile-time).
However, if you are ready to make $mytest "exist" when MyTest is being
loadeded, you may put the "MULTI" flag on its gv.
Compare results:
perl -MDevel::Peek -wle "Dump \*c"
perl -MDevel::Peek -wle "Dump \*c; print $c"
You see that MULTI flags differ.
Hope this helps,
Ilya
------------------------------
Date: Mon, 24 Apr 2006 22:46:03 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: How to remove all duplications of characters
Message-Id: <e2jkjc.1fs.1@news.isolution.nl>
Anno Siegel schreef:
> Dr.Ruud:
>> (there can be more in [[:alpha:]] than is in [A-Za-z])
>
> $_ = 'Heelllooo WWWoorrld';
> do {
> my $alpha = join '' =>
> grep /[[:alpha:]]/,
> map chr, 0 .. 255; # or whatever
> eval "sub { tr/$alpha//s }";
> }->();
> print "$_\n";
>
> :)
Heheh, I actually had this technique of yours (!) in mind while posting.
The 'whatever' can be quite big:
#!/usr/bin/perl
use strict;
use warnings;
my ($alpha, $i, $n) = ('', 0, 0);
for (0x0000..0xD7FF, 0xE000..0xFDCF, 0xFDF0..0xFFFD) {
++$i;
$_ = chr;
$alpha .= $_ if /[[:alpha:]]/;
}
printf "%d / %d = %d%%\n", $n = length $alpha, $i, 100 * $n / $i;
printf "%s\n", substr( $alpha, 0, 160 );
__END__
47276 / 63454 = 74%
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz...
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Mon, 24 Apr 2006 21:48:27 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Term::ReadKey on Win? 5.005 vs 5.8.8?
Message-Id: <e2jh8b.t0.1@news.isolution.nl>
Dr.Ruud schreef:
> the first-13-gets-eaten-bug
Actually, a lonely <13> stays (buffered/pending), and gets displayed if
you press a different key.
Only when followed by one or two <13>s (as created with Ctrl-M or
Enter), one of the <13>s gets eaten.
The cycle restarts at display: the buffered <13>s (minus one if there
are more than one) are displayed, followed by the last key that was
pressed.
The fourth <13> (in a row) also results in display (so then three <13>s
are displayed).
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Mon, 24 Apr 2006 21:22:41 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Term::ReadKey on Win? 5.005 vs 5.8.8?
Message-Id: <e2jfj1$26st$1@agate.berkeley.edu>
[A complimentary Cc of this posting was NOT [per weedlist] sent to
Dr.Ruud
<rvtol+news@isolution.nl>], who wrote in article <e2j6rj.2io.1@news.isolution.nl>:
> > AFAIU, one should debug PerlIO; most probably, the bug is there.
> It is not just the bug, but also the lack of support for Function-keys
> and special combinations with Alt/Ctrl/Shift, etc.
I did not get this before. Do you say that the getc() version does
NOT produce useful output if you press, e.g., Left key, or Shift-F8?
I would expect to get 0/75 for Left, and 0/91 for Shift-F8.
> > One should check with pre-5.6.0 Perl first, which has no PerlIO.
> > Or write a simple C test with read(in, buf, 1) (the C code to
> > replace TRK on Win is provided in one of the (p5p?) threads I
> > mentioned before; google for CON CONIN ReadKey).
> In the code in my previous post, the first-13-gets-eaten-bug is not
> there, as long as you leave USE_GETC at 0.
> With SET_BINMODE 1, there are no eaten or delayed 13s, even if USE_GETC
> is 1 and/or USE_CONIN is 0.
I assume this is with some pre-5.6.0 Perl, right? Could you also
post: which version, build by who?
Your mention of USE_GETC is confusing. AFAICS, all it does is
switching between getc and read(...,1). And IIRC, in all versions of
Perl getc() is just a shortcut for read(...,1). Could you recheck the
case where you see that getc vs read makes a difference? If true,
which case it is exactly?
Anyway, as this shows, CRTL has no problem with reading; so if the
newer build uses the same CRTL, this is yet-another-bug in PerlIO.
> Wow, that
> http://search.cpan.org/src/ILYAZ/Term-ReadLine-Perl-1.03/ReadLine/readline.pm
> is pretty loaded with externalizable stuff, like Vi-mode and keymaps
> etc.
Now if only I knew whether "externalizable" (in your usage) is for
good things, or for bad things... ;-)
Thanks,
Ilya
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 9197
***************************************