[18654] in Perl-Users-Digest
Perl-Users Digest, Issue: 822 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 2 14:16:10 2001
Date: Wed, 2 May 2001 11:15:22 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <988827322-v10-i822@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 2 May 2001 Volume: 10 Number: 822
Today's topics:
Re: Should Perl be first? <newspost@coppit.org>
Re: Should Perl be first? (Rudolf Polzer)
Re: Should Perl be first? (Abigail)
SIGCHLD signal on HPUX10.20 <risto.vaarandi@eyp.ee>
Re: Strange string -> num conversion <skilchen@swissonline.ch>
Re: Strange string -> num conversion <skilchen@swissonline.ch>
Re: Unicode sucks. I'm dumb at it. <dan@nospam_dtbakerprojects.com>
Re: Unicode sucks. I'm dumb at it. <b_nospam_ill.kemp@wire2.com>
Re: Unicode sucks. I'm dumb at it. <pne-news-20010502@newton.digitalspace.net>
Re: Windows Komodo users get input on debug? (Arek P)
WTD: PERL SCRIPT writing for small task, payment no pro <helen.greenacre@ntlworld.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 2 May 2001 09:40:11 -0400
From: David Coppit <newspost@coppit.org>
Subject: Re: Should Perl be first?
Message-Id: <Pine.SUN.4.33.0105020928550.11808-100000@mamba.cs.Virginia.EDU>
On Tue, 1 May 2001, Abigail wrote:
> [] A beginning data structures and algorithm book should do the
> [] trick, although keep in mind that Perl's built-in data structures
> [] are so powerful you may never need the DS stuff. :)
> I strongly disagree with the last remark. Text books on datastructures
> never discuss scalars, usually don't bother with arrays, and may
> spend a small chapter on hashes.
>
> And that's all the datastructures Perl has. But they are nothing more
> than the building blocks. And unless you are only interested in
> exact match queries, totally unsuitable to do any efficient searching.
>
> It's like saying you might never need a book on building a house
> because you already have shiny bricks.
I've never needed to implement a linked list, red-black tree (or
tree, for that matter), vector, set, bad, stack, heap, etc. Why?
because most of the time Perl's data structures do the job:
SET
Add to set: $hash{'element'} = 1
Check existence in set: exists $hash{'element'}
Remove from set: delete $hash{'element'}
BAG
Add 3 copies to bag: $hash{'element'} = 3
Delete 1 copy from bag: $hash{'element'}-- if $hash{'element'} > 0
STACK:
Push: push @array, 'element'
Pop: pop @array, 'element'
LINKED LIST:
Add: push @array, 'element'
Remove: shift @array, 'element'
Of course, abstract interfaces to these data structures could be built
using ADTs. But a quick search on CPAN doesn't reveal any linked list
module, although there is a Tree::RedBlack. So maybe I've proven you
point. :)
--
David
------------------------------
Date: Wed, 2 May 2001 18:24:30 +0200
From: eins@durchnull.de (Rudolf Polzer)
Subject: Re: Should Perl be first?
Message-Id: <slrn9f0d5u.251.eins@www42.t-offline.de>
Abigail <abigail@foad.org> wrote:
> Rudolf Polzer (eins@durchnull.de) wrote on MMDCCC September MCMXCIII in
> <URL:news:slrn9eu6nn.ke.eins@www42.t-offline.de>:
> }}
> }} Of course. But Pascal->C is IMHO easier than C++->C: C++ and C have the
> }} same syntax, but when you start with C++, you'll learn nothing about malloc,
> }} char * and such things that you have to learn to deal with. When you did Pas
> }} before, you already know malloc as GetMem and you know the pitfalls.
>
>
> Pascal as Go^WWirth intended doesn't have GetMem.
Sorry, I meant Turbo Pascal.
--
#!/usr/bin/perl -W -- WARNING: This will print 22,307 bytes! <strictsafe!>
use strict;for(my$y=-1;$y<1;$y+=.1){for(my$x=-1.9;$x<.4;$x+=.03){print'+';
my$X=my$Y=0;for(0..99){($X,$Y)=($X*$X-$Y*$Y+$x,2*$X*$Y+$y);print"\b "if$X*
$X+$Y*$Y>9;}}print"\n"};print''.reverse"\nHPAJ \a!rezloP .R yb torblednaM"
------------------------------
Date: Wed, 2 May 2001 14:57:46 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Should Perl be first?
Message-Id: <slrn9f083a.1u2.abigail@tsathoggua.rlyeh.net>
David Coppit (newspost@coppit.org) wrote on MMDCCCI September MCMXCIII in
<URL:news:Pine.SUN.4.33.0105020928550.11808-100000@mamba.cs.Virginia.EDU>:
@@ On Tue, 1 May 2001, Abigail wrote:
@@
@@ > [] A beginning data structures and algorithm book should do the
@@ > [] trick, although keep in mind that Perl's built-in data structures
@@ > [] are so powerful you may never need the DS stuff. :)
@@
@@ > I strongly disagree with the last remark. Text books on datastructures
@@ > never discuss scalars, usually don't bother with arrays, and may
@@ > spend a small chapter on hashes.
@@ >
@@ > And that's all the datastructures Perl has. But they are nothing more
@@ > than the building blocks. And unless you are only interested in
@@ > exact match queries, totally unsuitable to do any efficient searching.
@@ >
@@ > It's like saying you might never need a book on building a house
@@ > because you already have shiny bricks.
@@
@@ I've never needed to implement a linked list, red-black tree (or
@@ tree, for that matter), vector, set, bad, stack, heap, etc. Why?
@@ because most of the time Perl's data structures do the job:
If your job is simple queries, yes.
But how would you use Perl's data structures to do for instance nearest
neighbour queries (which doesn't ask "does X belong to the set S" but
"which Y in S is closest to X?"), range queries ("give me all elements
in S between X and Y") or half planar queries (for instance "how many
points (x,y) of S satisfy x + y > Z")? Linear query times are unacceptable.
@@ SET
@@ Add to set: $hash{'element'} = 1
@@ Check existence in set: exists $hash{'element'}
@@ Remove from set: delete $hash{'element'}
@@
@@ BAG
@@ Add 3 copies to bag: $hash{'element'} = 3
@@ Delete 1 copy from bag: $hash{'element'}-- if $hash{'element'} > 0
@@
@@ STACK:
@@ Push: push @array, 'element'
@@ Pop: pop @array, 'element'
@@
@@ LINKED LIST:
@@ Add: push @array, 'element'
@@ Remove: shift @array, 'element'
They are all simple building blocks for more advanced data structures.
Abigail
--
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))
------------------------------
Date: Wed, 02 May 2001 19:06:32 +0200
From: Risto Vaarandi <risto.vaarandi@eyp.ee>
Subject: SIGCHLD signal on HPUX10.20
Message-Id: <3AF03E98.61C249A7@eyp.ee>
hello,
I have written a perl program that forks child processes, and logs their
exit status when it receives SIGCHLD from kernel.
The program works fine on linux and solaris, but on hpux10.20 the parent
process receives SIGCHLD endlessly, so the parent is unable to get out
of the signal handler. The program does not call waitpid() in the
handler, but just sets a flag to indicate that waitpid() must be called
later.
Has anyone experienced that, and is that normal behaviour?
regards,
risto
------------------------------
Date: Wed, 2 May 2001 16:59:47 +0200
From: "Samuel Kilchenmann" <skilchen@swissonline.ch>
Subject: Re: Strange string -> num conversion
Message-Id: <9cp7pk$evtle$1@ID-13368.news.dfncis.de>
"David H. Adler" <dha@panix6.panix.com> wrote in:
news:slrn9eui4p.9o3.dha@panix6.panix.com...
> Data points:
>
> using perl -le 'print "0x12" + 1':
>
> debian:~$ perl553 -le 'print "0x12" + 1'
> 19
> This is perl, version 5.005_03 built for i586-linux
>
> debian:~$ perl56 -le 'print "0x12" + 1'
> 19
> This is perl, v5.6.0 built for i586-linux
>
> using Rudolf's C program:
>
> debian:~$ ./stontst
> 18.000000
> 1.125000
>
> using Samuel's C program:
>
> debian:~$ ./stontst2
> f1: 1.125000
> f2: 1.125000
> f3: 10.000000
> 18.000000
> 1.125000
> 1.125000
> 1.125000
> 10.000000
>
> Good luck figuring out what this all means. :-)
>
It means:
1. Perl is using whatever String->Number conversion the C stdlib
provides
2. you have a C compiler that correctly handles hexadecimal
floating-point constants.
3. your C stdlib seems to convert hexadecimal floating-point string
litterals into binary floats according to the rules of C99
And finally:
A adjusted quote from Don Porter in
http://dev.scriptics.com/lists/tclcore/2000/09/msg00197.html
Do we want to expose another C format for numbers at script level?
Given the confusion over octal numbers, does it really make
sense to add script-level support for another format mostly
suitable for precise bit-by-bit specification of floating point
values? That sort of thing is necessary in a system programming
language like C, but is it really a benefit for Perl (orig. Tcl)?
I agree with Mr. Porter and i think that Perl should provide its
own String->Number conversions to avoid this dependency from C
library versions.
------------------------------
Date: Wed, 2 May 2001 17:02:30 +0200
From: "Samuel Kilchenmann" <skilchen@swissonline.ch>
Subject: Re: Strange string -> num conversion
Message-Id: <9cp7pm$evtle$2@ID-13368.news.dfncis.de>
"Rudolf Polzer" <eins@durchnull.de> wrote in
news:slrn9eugqc.27o.eins@www42.t-offline.de...
> Where can I check about the C99 support in gcc?
Here you will find an overview:
http://www.gnu.org/software/gcc/c99status.html
But that only covers the hexadecimal floating-point constants.
The atof(), strtod(), etc. issue is related to the glibc project. As
far as i know the conversion for hexadecimal floating-point strings
was introduced in glibc 2.1 and it was buggy at least until 2.1.3
One year ago (20000410) there was even a bug report using a Perl
example, see:
http://bugs.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=1683&database=default
According to the audit trail to bugreport 1683, it is a known fact
that the manual pages are out of sync.
------------------------------
Date: Wed, 02 May 2001 13:49:18 GMT
From: Dan Baker <dan@nospam_dtbakerprojects.com>
Subject: Re: Unicode sucks. I'm dumb at it.
Message-Id: <3AF00EFF.F8FA7E36@nospam_dtbakerprojects.com>
Cameron wrote:
> #!/usr/local/bin/perl5.6.1
--------
try added -w to get your warnings....
#!/usr/local/bin/perl5.6.1 -w
D
------------------------------
Date: Wed, 2 May 2001 17:19:03 +0100
From: "W K" <b_nospam_ill.kemp@wire2.com>
Subject: Re: Unicode sucks. I'm dumb at it.
Message-Id: <988820382.871.0.nnrp-07.c3ad6974@news.demon.co.uk>
>Ok, here's my problem, incase anyone knows anything about unicode bizness.
>$site = $query->param('whois');
>print "Content-type: text/html; charset=ISO-8859-1\n\n";
>print $site;
>now, say i enter a utf-8 heart symbol into my little submission html page,
>one would expect that to be passed as the param for "whois" into $site. it
a html / cgi / web question really.
You are telling the browser that what you are sending is NOT utf-8 when you
say "charset=ISO-8859-1".
It is doing what you are telling it to.
More complicated than this I find, (and it confuses me so don't trust me).
is that you can send the 'utf-8' part in the http headers (Something like
this probably way off the mark).
or you can put the charset as utf-8 in the html <head></head> section.
------------------------------
Date: Wed, 02 May 2001 18:24:23 +0200
From: Philip Newton <pne-news-20010502@newton.digitalspace.net>
Subject: Re: Unicode sucks. I'm dumb at it.
Message-Id: <2lc0ftgn000dljnup48p07615a31mdaboh@4ax.com>
On Wed, 2 May 2001 12:46:10 +0000 (UTC), cameron@nicnames.co.uk
(Cameron) wrote:
> now, say i enter a utf-8 heart symbol into my little submission html page,
Do you know the code point of the heart symbol you are using? Three
characters come to mind:
* U+2661 WHITE HEART SUIT
* U+2665 BLACK HEART SUIT
* U+2764 HEAVY BLACK HEART
> one would expect that to be passed as the param for "whois" into $site. it
> works, all except for the fact that the heart symbol turns into something
> that isn't even utf-8 anymore. it turns into a ¢¾ - a "cents" symbol, and a
> 3/4 symbol.
That is strange; according to my table, ¢¾ is 0xa2 0xbe, or
0b1010_0010 0b1011_1110, or 0b10_1000_10 0b10_11_1110. Since both
bytes have 0b10 as the top two bits, they would both be UTF-8
continuation characters. This could be a sequence where the first
character is missing. But if those two characters are the last two in
a sequence of three or more bytes, then the character represented
would have 0x8be as its low three nybbles, which doesn't match any of
the three hearts above. (And since characters with code points <=
0xFFFF can be represented in three UTF-8 characters, and there are
probably not many characters in use beyond the BMP, I'd say that if
they're UTF-8 continuation bytes, there can only be one more byte
missing, which would have to be in the range E1 .. EF.)
U+2661 would be 0xe2 0x99 0xa1 in UTF-8, or ♡ as bytes.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Wed, 2 May 2001 11:19:39 EDT
From: Arek@nospam.tv (Arek P)
Subject: Re: Windows Komodo users get input on debug?
Message-Id: <9cp8ib$1gpb$1@earth.superlink.net>
On Tue, 01 May 2001 03:09:53 GMT, "Rob"
<"relaxedrob@optushome.com.au"> wrote:
I doubt that this is considered a bug; If You look at the help docs
that came with Komodo it clearly states that in order to be able to
send input You have to use the console window; so when U try to run
debugger, check off the 'Debug in separate console' option and then U
will be albe to do it. I know that the Komodo debuggers' output tab
will show the prompt with the cursor waiting for Your input, which
would appear to suppose to work, but it does not, You cannot type
anything and it just sits there. It seems to me that output win is
non-input scripts...at least this is what I got out of the help
pages...
ArekP
>Hi all!
>
>I am interested to hear from anyone using Komodo on Windows who is able to
>send input to their perl scripts through the debugger. This feature does not
>seem to work on my machine. I have submitted a bug report but am after
>anyone else who has had the same..
>
>Rob
>
>
------------------------------
Date: Wed, 2 May 2001 17:15:29 +0100
From: "Helen Greenacre" <helen.greenacre@ntlworld.com>
Subject: WTD: PERL SCRIPT writing for small task, payment no problem!
Message-Id: <pnWH6.15087$Kt2.1525346@news6-win.server.ntlworld.com>
Hi
I do not know Perl myself and need a script writing, payment is no
problem...see below..
The task
---------
A text file is produced from our system, it could contain a number of lines
(around 10-60) it looks something like this
23456076, ee, 12,12,12, 31/10/2001
03046789, es, 33,12,12, 12/12/2001
03446889, es, 33,12,12, 12/12/2001
06049789, es, 33,12,12, 12/12/2001
13046789, es, 33,12,12, 12/12/2001
etc etc...
The beginning 8 numbers on each line represent a file which is actually a
PDF (so, example first line 23456076 is infact 23456076.pdf etc..)
I need a Perl script that looks a the 'input' file and looks at the first 8
digits of each line, then looks at a mapped drive (one location) to find the
relevant files (which all end with .pdf), the script would then have to COPY
(not move) the pdf's into another mapped drive..
A log file must be produced that displays the files that have been found and
those that have not (ie the ones that have errored or missing)
I have a small program that constantly scans folders for input files and
then runs a certain command on them, the idea would be that the original
input text file is dropped into a 'hot' folder, the Perl script then runs
against this file etc....
If anyone would be interested in writing this script (to run on a Windows NT
workstation) please E-mail me to discuss timescale/price etc..
Thanks
Helen
------------------------------
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.
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 822
**************************************