[27491] in Perl-Users-Digest
Perl-Users Digest, Issue: 9088 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Mar 25 09:05:48 2006
Date: Sat, 25 Mar 2006 06:05:05 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 25 Mar 2006 Volume: 10 Number: 9088
Today's topics:
Re: Calculations with ',' as decimal delimiter <hjp-usenet2@hjp.at>
Re: Debugging with Speech: Issues and Work-arounds? <vtatila@mail.student.oulu.fi>
Re: Debugging with Speech: Issues and Work-arounds? <rvtol+news@isolution.nl>
Re: file renamer... request feedback <noone@nowhere.com>
Re: file renamer... request feedback <noone@nowhere.com>
Re: file renamer... request feedback <noone@nowhere.com>
Re: file renamer... request feedback <rvtol+news@isolution.nl>
Re: file renamer... request feedback <rvtol+news@isolution.nl>
Re: file renamer... request feedback <tadmc@augustmail.com>
Re: LWP and HTTP HEAD <news@chaos-net.de>
Re: LWP and HTTP HEAD <news@chaos-net.de>
Re: More help requested on permutation code. (Anno Siegel)
Re: Security implications of taking a stylesheet URL fr <seppi@seppig.de>
Re: Would like to make a system call without displaying <bart.lateur@pandora.be>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 25 Mar 2006 14:42:36 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Calculations with ',' as decimal delimiter
Message-Id: <cch30e.n5k.ln@teal.hjp.at>
Anno Siegel wrote:
> If your system supports locale, you can use that:
>
> use locale;
> use POSIX qw( strtod);
> POSIX::setlocale( POSIX::LC_NUMERIC(), 'de_DE');
>
> print strtod( '12,34') + strtod( '56,78'), "\n";
Be careful there. This breaks silently if the locale 'de_DE' isn't
actually installed. Then you will just get the result 68 instead of
69,12. Be sure to check the return code of setlocale.
hp
--
_ | Peter J. Holzer | Löschung von at.usenet.schmankerl?
|_|_) | Sysadmin WSR/LUGA |
| | | hjp@hjp.at | Diskussion derzeit in at.usenet.gruppen
__/ | http://www.hjp.at/ |
------------------------------
Date: Sat, 25 Mar 2006 13:32:31 +0200
From: "Veli-Pekka Tätilä" <vtatila@mail.student.oulu.fi>
Subject: Re: Debugging with Speech: Issues and Work-arounds?
Message-Id: <e039oo$d7q$1@news.oulu.fi>
Ilya Zakharevich wrote:
> So far I can remember 3 places in debugger you complain about:
> a) How dumpvar.pl/Dumpvar.pm dump an array;
Yes, though as I said, this is easy enough to side step with some filtering
or printed code run with the p command, at least for non-nestedd structures.
That is so easy that it doesn't make too much sense, in my view, to even
modify the debugger for this. Maybe I could add some aliases for different
kinds of speech-friendly pretty printing.
> b) Pre-prompt "positional info" output;
It is one of the more serious issues. I'm especially irked by the pakage and
file path prompt before the code. It is not that bad in virtual focus, a
screen reader specific navigation mode, as it is taken to be a single word.
However, If one would just like to get an idea of which line it is and so
use the automatic reading after an enter press, there's no easy way to skip
the package info in that case. THis is called reading in live focus in
Supernova, because no screen reader specific navigation commands are
involved and the reader tracks the OS's keyboard focus. I'll use the terms
live focus (LF) and virtual focus (VF) from now on.
Most of my other complaints have been vpretty minor. So I guess changing
this one bit in the debugger would neatly satisfy most of my changes. I'll
look into it.
> c) Debugger's prompt itself.
Yep, though, again, this is small potatoes in comparison to the previous
issue. I just mentioned it for completeness.
There's at least one issue you forgot, though it is not that big, either,
because good HTMl manual pages are available.
d) Inability of GUI-readers to distinguish multi-column layout in the
console.
This means in practise that on trying to read the help screen line by line
in VF, it reads across the columns without pauses. It makes the output
somewhat difficult to grasp in sensible chunks. In contrast, most help
screens including the one for Perl, don't depend on the column structure to
be intelligible. In the perl help columns aren't recognized either but the
order: switch, description makes sense even in line chunks.
Maybe I should add another thing, which would be a nice extra:
e) Finding only parts of code lines with regular expressions.
This is basically the same as the regexp searching commands, except that it
should be able to display just the matching bits on a line, not the whole
line. This feature would be helpful in trying to re-read bits of code in LF,
without having to use virtual focus to cursor around the code. If one has to
switch to a text editor for code reading, some serious issues will arise. It
turns out that the screen reader forgets its virtual focus position when you
come back to the same window, meaning you'll have to start cursoring from
the top of the window again.
> 'b' and 'c', you may need to modify the debugger itself.
> 0) Find the code which prints "positional info";
> 1) Separate it into a subroutine which takes all the information
> from its arguments (no access to global variables). Likewise for
> the prompt-creation code.
> 2) Make the debugger to access this code through subroutine references
> stored in global variables;
> 3) Reset these global variables to the values which suit you (from
> ~/.perldbrc).
Thanks for the instructions, I've archived this bit.
>>> I think a short summary of the problems as you see them would make
>>> things much more grokable.
>> It is remarkably difficult unless you've used a screen reader before.
> Maybe I will need *soon*. ;-(
> [Many pages of very detailed discussion skipped.]
Oh woops, <grin>. Maybe it would be just easier to run a demo of a Windows
screen reader or compile some Linux reader from sources. Most Windows
readers already come with their own speech synths and are pretty easy to
install.
Supernova, the one I'm using, can be found here:
http://www.dolphincomputeraccess.com/products/index.htm
For screen reading alone, HAl will do just as well.
For Linux, the Yasr reader with the Festival speech synth, is a basic screen
reader not tied to a particular editor, like Emacs. I think Gentoo and
Debian have packages for both.
> WHAT ELSE (capitalized ;-) would you like to be changed?
Not much I guess. Resolving the out-of-order issue would be half of the
problem, I think. Turning the help into single columns would be nice, but I
can live without it or do the conversion in a text file manually. The same
goes for browsing the code, it is doable in a text editor. To be able to
answer this question comprehensively I'll need to play some more with the
debugger. I'm just getting into command-line debugging, having done it in
Visual Studio for CPP prior to this, and wanted to highlight the most
frequent and or obvious issues.
Hey, thanks for telling me explicitly about the caps. Smilies could be added
on the list, too. They are rendered partly or not at all, as I have no
punctuation or formatting prompts on when reading normal e-mail, for
efficiency's sake.
--
With kind regards Veli-Pekka Tätilä (vtatila@mail.student.oulu.fi)
Accessibility, game music, synthesizers and programming:
http://www.student.oulu.fi/~vtatila/
------------------------------
Date: Sat, 25 Mar 2006 12:53:34 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Debugging with Speech: Issues and Work-arounds?
Message-Id: <e03etj.js.1@news.isolution.nl>
Ilya Zakharevich schreef:
> [Ilya suggests Veli-Pekka Tätilä how to tune the debugger]
> I think this is going to be a very small modification to the
> debugger. (When done, do not forget to post patches to
> perl5-porters.)
Ilya, thanks for this stimulating post. I have never used perl's
debugger, and maybe never will, but I will always remember that it is
easy to tune.
--
Affijn, Ruud
"Gewoon is een tijger."
echo 014C8A26C5DB87DBE85A93DBF |perl -pe 'tr/0-9A-F/JunkshoP cartel,/'
------------------------------
Date: Sat, 25 Mar 2006 08:11:06 GMT
From: TOC <noone@nowhere.com>
Subject: Re: file renamer... request feedback
Message-Id: <uW6Vf.47477$G_2.7288@fe08.news.easynews.com>
robic0 wrote in news:b9u922dnbv1r15n1laeufvitkshb5orp1e@4ax.com:
> I'm drunk after my last ISP rant but
> not saying it doesen't exitst but what does y// do?
> I'm sure it does somethig, I'm no expert thoug
it is an alias of tr
the end still needs work.
#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
use Fatal;
use File::Find;
finddepth(\&f, ".");
sub f
{
return if /^\./ or /lost\+found/;
my $o = $_ ;
y/A-Z/a-z/;
y/a-z0-9._/_/c;
s/^_+//;
s/\.mpeg$/\.mpg/;
s/\.ram$/\.rm/;
s/\.qt$/\.mov/;
s/\.jpeg$/\.jpg/;
s/_\./\./g;
s/\._/_/g;
y/_//s;
y/.//s;
return if $_ eq $o or -e $_;
if (rename $o, $_)
{
print "\n $File::Find::name -> \n $File::Find::dir/$_\n";
}
else
{
print "failed: $!\n"; die "faild to rename $o to $_, left as $o";
}
}
------------------------------
Date: Sat, 25 Mar 2006 08:18:22 GMT
From: TOC <noone@nowhere.com>
Subject: Re: file renamer... request feedback
Message-Id: <h17Vf.47489$G_2.46993@fe08.news.easynews.com>
robic0 wrote in news:fpu922lom8uis27tlpnsc3paaqogudvkc8@4ax.com:
>>
>
> I'm missing the &'s you name (except for $o). Is too much cut from
> the quote?
are you talking about this?
#!/usr/bin/perl -nl
$o=$_;y/ /_/;-e||print("renaming $o => $_")&&rename$o,$_
If not, I am not sure what you are asking.
------------------------------
Date: Sat, 25 Mar 2006 08:45:46 GMT
From: TOC <noone@nowhere.com>
Subject: Re: file renamer... request feedback
Message-Id: <_q7Vf.174784$KG5.88034@fe04.news.easynews.com>
>>>#!/usr/bin/perl -nl
>>>$o=$_;y/ /_/;-e||print("renaming $o => $_")&&rename$o,$_
>>>
>>>If not, I am not sure what you are asking.
>>Over my head but I'm lazy, don't want to read unless I have to.
>>It's my eyeballs, they aren't round, not quite square either..
>>I think its my brains protection. All it wants to do is think,
>>sheesh...
>
> I just wan't to follow up here a little.
> I am blasted so I may read this tommorow and decided it was a stupid
> thing to write.
> Although this line:
> $o=$_;y/ /_/;-e||print("renaming $o => $_")&&rename$o,$_ (complete?)
> might look intimidating to me at first glance, especially the "&&",
> I would not like to have to figure this out, especially with
> suspect imbed Unix switches >>#!/usr/bin/perl -nl
> when I'm a windows guy you know?
>
> I'm so lazy, I let my 170 IQ sleep in 2 hours while I go
> for a 4 mile jog..
>
> robic0
>
>
Deparse is your friend:
# perl -MO=Deparse f.pl
BEGIN { $/ = "\n"; $\ = "\n"; }
LINE: while (defined($_ = <ARGV>)) {
chomp $_;
$o = $_;
tr/ /_/;
print "renaming $o => $_" and rename $o, $_ unless -e $_;
}
f.pl syntax OK
------------------------------
Date: Sat, 25 Mar 2006 13:00:41 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: file renamer... request feedback
Message-Id: <e03fgc.v8.1@news.isolution.nl>
John Bokma schreef:
> Uri Guttman:
>> just go learn python already. they will welcome with open arms (if
>> they had arms)
>
> uncalled for, don't turn this in a language war.
I read it as a {{{{joke}}}}. Why should Perl get all of 0?
--
Affijn, Ruud (has a wife called Joke [yoka], which in her case
could be short for Johanna Cornelia).
"Gewoon is een tijger."
echo 014C8A26C5DB87DBE85A93DBF |perl -pe 'tr/0-9A-F/JunkshoP cartel,/'
------------------------------
Date: Sat, 25 Mar 2006 13:12:51 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: file renamer... request feedback
Message-Id: <e03g3e.ao.1@news.isolution.nl>
TOC schreef:
> if (rename $o, $_)
> {
> print "\n $File::Find::name -> \n $File::Find::dir/$_\n";
> }
> else
> {
> print "failed: $!\n"; die "faild to rename $o to $_, left as
> $o"; }
if ($_ eq $o) {...}
elsif (rename $o, $_) {...}
else {...}
And maybe, with some clever tricks, you could write it as
if ($o.eq) {...}
elsif ($o.mv) {...}
else {...}
And I still forgot to test $_ for pre-existance.
--
Affijn, Ruud
"Gewoon is een tijger."
echo 014C8A26C5DB87DBE85A93DBF |perl -pe 'tr/0-9A-F/JunkshoP cartel,/'
------------------------------
Date: Sat, 25 Mar 2006 07:42:42 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: file renamer... request feedback
Message-Id: <slrne2ai6i.7ic.tadmc@magna.augustmail.com>
TOC <noone@nowhere.com> wrote:
[ missing a couple levels of attribution, please don't do that ]
>> T> $new =~ s/_\./\./g; # replace _. with .
>> T> $new =~ s/\._/_/g; # replace ._ with _
>>
>> read those comments carefully. are they WHAT or WHY?
>
>
> well the overall purpose of the script is to make the names pretty...
> according to what I define as pretty =)
Your response leads me to believe that you have missed the point
that Uri was trying to make.
The code says to replace _. with . and the comment says to
replace _. with .
Why bother to say the same thing twice?
The comments are where you get to specify what you define to be "pretty".
>> T> $new =~ tr/__//s; # squeeze repeated _'s
>> T> $new =~ tr/..//s; # squeeze repeated .'s
>> your comments are mostly what. try to learn how to say why. ask
>> yourself the question, WHY am i replacing _. with . and put that
>> answer in the comment.
eg:
$new =~ s/_\./\./g; # underscores next to dots are ugly (not pretty)
$new =~ s/\._/_/g;
> well I am replacing ._ with _ and _. with . to fix the following examples:
"to fix" kinda requires an explanation of what is broken
in the first place...
> my_file_.txt
> my_other._file.txt
eg:
well I am replacing ._ with _ and _. with . because
underscores next to dots are ugly
(and your code won't "fix" my_file__.txt )
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 25 Mar 2006 11:48:30 +0100
From: Martin =?iso-8859-1?Q?Ki=DFner?= <news@chaos-net.de>
Subject: Re: LWP and HTTP HEAD
Message-Id: <slrne2a7vu.4ub.news@maki.homeunix.net>
J. Gleixner wrote :
> Martin Kißner wrote:
>
>> When I compare the results to a telnet session I always get three
>> additional fileds (the values are from de.yahoo.com):
>>
>> Client-Date: Thu, 23 Mar 2006 21:55:37 GMT
>> Client-Peer: 217.12.3.11:80
>> Client-Response-Num: 1
>>
>> These are produced by LWP an not part of the server's response.
>> AFAIK they are not even part of the HTTP spec.
>> Why are thes returned as "header fields"?
>
> They're set by LPW::Protocol::http.pm, no idea why. Try asking the author.
I did so and I will let you know the answer.
Best regards
Martin
--
perl -e '$S=[[73,116,114,115,31,96],[108,109,114,102,99,112],
[29,77,98,111,105,29],[100,93,95,103,97,110]];
for(0..3){for$s(0..5){print(chr($S->[$_]->[$s]+$_+1))}}'
------------------------------
Date: Sat, 25 Mar 2006 14:25:14 +0100
From: Martin =?iso-8859-1?Q?Ki=DFner?= <news@chaos-net.de>
Subject: Re: LWP and HTTP HEAD
Message-Id: <slrne2ah5q.5b9.news@maki.homeunix.net>
Martin Kißner wrote :
> J. Gleixner wrote :
>> Martin Kißner wrote:
>>
>>> When I compare the results to a telnet session I always get three
>>> additional fileds (the values are from de.yahoo.com):
>>>
>>> Client-Date: Thu, 23 Mar 2006 21:55:37 GMT
>>> Client-Peer: 217.12.3.11:80
>>> Client-Response-Num: 1
>>>
>>> These are produced by LWP an not part of the server's response.
>>> AFAIK they are not even part of the HTTP spec.
>>> Why are thes returned as "header fields"?
>>
>> They're set by LPW::Protocol::http.pm, no idea why. Try asking the author.
>
> I did so and I will let you know the answer.
This is the (shortened) answer by Gisle Aas, which I recieved about 20
minutes after I had asked:
- LWP adds them [the Client-... headers] by itself to be helpful. There
- can be other Client-* headers depending on what protocol module
- processed the request, see
- http://search.cpan.org/dist/libwww-perl/lib/LWP.pm#NETWORK_SUPPORT
Thank you, Gisle.
Best regards
Martin
--
perl -e '$S=[[73,116,114,115,31,96],[108,109,114,102,99,112],
[29,77,98,111,105,29],[100,93,95,103,97,110]];
for(0..3){for$s(0..5){print(chr($S->[$_]->[$s]+$_+1))}}'
------------------------------
Date: 25 Mar 2006 13:56:57 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: More help requested on permutation code.
Message-Id: <48l0h9Fkpb7mU1@news.dfncis.de>
Michael Press <jack@abc.net> wrote in comp.lang.perl.misc:
> In article <48igj9Fkdg2tU1@news.dfncis.de>,
> anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:
>
> > Michael Press <jack@abc.net> wrote in comp.lang.perl.misc:
>
> [...]
>
> > > my $alpha = "(99)(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
> 20 21 22)";
> > > my $beta = "(99)(0)(3 6 12 1 2 4 8 16 9 18 13)(15 7 14 5 10 20 17 11 22
> > > 21 19)";
> > > my $gamma = "(99 0)(1 22)(2 11)(3 15)(4 17)(5 9)(6 19)(7 13)(8 20)(10
> > > 16)(12 21)(14 18)";
> > > my $delta = "(99)(0)(3)(15)(1 18 4 2 6)(5 21 20 10 7)(8 16 13 9 12)(11
> > > 19 22 14 17)";
> > > my $x;
> >
> > What are all the single-element cycles for? They map to the unit
> > permutation and have no effect.
>
> These are (redundant) generators of a real world group. As
> you see in the next bit of code, if the singletons were
> not present in $beta, then the result of
> permutation_multiply $beta and
> permutation_multiply ($alpha x 2 ...
> would not be the same.
Hmm... Well, permutation_multiply() does more than its name implies
(printing out results on its own). Otherwise, the result of a permutation
multiplication should be independent of (redundant) singleton cycles
in the specification of the factors.
You appear to use the singletons as some kind of marker. I haven't seen
that technique before, and computationally it strikes me as cumbersome.
I'd try to make those markers independent of the basic permutation
operations.
> But more importantly these are generators of
> PSL_2 (GF_23), the group of automorphisms over the
> projective line in GF_23. GF_23 has 23 elements:
> {0, 1, ... 23}. The projective line has 24 elements:
> {infinity, 0, 1, ... 23}. (I use 99 for infinity).
>
> Since the permutation beta is an automorphism, we must
> define its behavior on every point.
Huh? If it were only an endomorphism we wouldn't have to define
its behavior in every point? I don't understand that argument.
> The fixed points of
> group elements are important in the analysis, so it is
> better when reading to see the singletons explicitly,
> rather than trying to infer them. For instance
> (alpha delta)^3 = (0) (1) (5) (6) (18) (20) (22) (99)
> (2 3) (4 15) (7 8) (9 11) (10 19) (12 16) (13 21) (14 17)
The fixed points of a permutation are exactly the elements that
don't appear in a cycle of length > 1. Computationally that's
very simple (once you have the non-singleton cycles).
[too much group theory for a Saturday afternoon snipped]
Anno
--
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
------------------------------
Date: Sat, 25 Mar 2006 13:41:15 +0100
From: Sebastian Gottschalk <seppi@seppig.de>
Subject: Re: Security implications of taking a stylesheet URL from a CGI parameter
Message-Id: <48ks3dFkdfstU1@news.dfncis.de>
Toby Inkster wrote:
> So I say, accept any style sheets -- just make sure you replace '"' with
> '"' and '<' with '<'.
Doesn't help against malicious JPEG images on IE (refering to the
second, unpatched vulnerability).
------------------------------
Date: Sat, 25 Mar 2006 11:14:53 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Would like to make a system call without displaying msg to STD OUT
Message-Id: <fa9a22dti59n4fasto2regbg7b05au18nm@4ax.com>
desert.fox11@yahoo.com wrote:
>I'll try to say this succinctly. I make a call using system "unzip -o",
>"$filename" which calls a utility unzip that has 'status' messages
>display to std out. This is fine, however, can I re-direct ( or at the
>very least suppress ) these messages.
> eg. " Inflating README.txt........"
>Any suggestion is appreciated.
Perhaps you are actually interested in reading those messages into your
program. The simplest way to achieve that, is to use backticks
("`command`"), AKA qx. See "qx" in perlop.
But that'll wait till the program is finished before returning. If you
want an intermediate update, you can call
open STATUS, "command |";
and read the output from the command through ordinary readline calls.
while(<STATUS>) { ... }
If you still want more, like piping into the command's STDIN or read its
STDERR separately, check out the modules IPC::Open2 and IPC::Open3. Both
come with Perl.
--
Bart.
------------------------------
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 9088
***************************************