[18457] in Perl-Users-Digest
Perl-Users Digest, Issue: 625 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 4 09:05:52 2001
Date: Wed, 4 Apr 2001 06:05:18 -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: <986389516-v10-i625@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 4 Apr 2001 Volume: 10 Number: 625
Today's topics:
'Use'ing shared objects (Robert Jones)
Adding hours to pre-defined date HOW (MAC)
Correctly processing foreign accents in CGIs <pr1@club-internet.fr>
Re: Correctly processing foreign accents in CGIs (Rafael Garcia-Suarez)
Re: Correctly processing foreign accents in CGIs <ubl@schaffhausen.de>
Re: Correctly processing foreign accents in CGIs <flavell@mail.cern.ch>
Re: Deleting one line from a file (Jay Tilton)
Difference between $! and $@ <cmon_209@hotmail.com>
Re: Difference between $! and $@ (Rafael Garcia-Suarez)
Re: fetch CGI::Cookie trouble... (Rafael Garcia-Suarez)
Re: How do I combine these <ronald.fischer.gp@icn.siemens.de>
Multiple email send?vvp <vprasad@americasm01.nt.com>
Re: Newbies welcome <moiraine{NOSPAM}@qwest.net>
Partly solved (was: pod2man says: bad option in paragra <ronald.fischer.gp@icn.siemens.de>
perl core dump with ill. instruction rlwinm on AIX4.3 <kwl@pine.dk>
Re: Perl Tutorial "Program Repair Shop and Red Flags" 2 (Anno Siegel)
Re: Please Flame my Benchmark: open vs. cat (Villy Kruse)
Re: Please Flame my Benchmark: open vs. cat (Abigail)
Re: Please Flame my Benchmark: open vs. cat (Abigail)
Re: Please Flame my Benchmark: open vs. cat (Gwyn Judd)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 04 Apr 2001 10:55:21 GMT
From: robert.jones@limecs.com (Robert Jones)
Subject: 'Use'ing shared objects
Message-Id: <3acafcf5.13740075@news.firstnet.co.uk>
I'm trying to make use of the perlcc 'compiler' to create shared
objects and the 'use' them in wrapper scripts in order to cut down on
interpretation time but I can't get it to work and the FAQs don't
help.
Does anyone know how to use a shared object file within a script?
Which module(s) do I need to read them in?
Cheers,
Rob
------------------------------
Date: Wed, 04 Apr 2001 12:35:37 GMT
From: macv@_multiweb.nl (MAC)
Subject: Adding hours to pre-defined date HOW
Message-Id: <tyEy6.37233$t9.3077691@news.soneraplaza.nl>
I have a problem to be solved, i would like a routine thats adds hours/days
to a pre-defined date and time. I have something that works but ONLY on a
local current time like this:
use constant SECONDS_PER_DAY => 60 * 60 * 24;
my $tomorrow = localtime( time + SECONDS_PER_DAY );
print "Tomorrow's date is $tomorrow\n";
The thing is, i need to parse to this routine, a newdate and time, and to
THAT date adding hours and/or days something like this:
DD M YEAR H M S, HOURS TO ADD
ReturnNewDate(01.01.2001.23.15.0,10);
This parses the date: 1 jan 2001 23:15:0 and ADDS 10 hours to it.
Returns: $found= "02.01.2001.9.15.0"; ( 2 jan 2001 9:15:0)
Can someone help me with this ?
------------------------------
Date: Wed, 04 Apr 2001 09:26:54 +0200
From: Philippe de Rochambeau <pr1@club-internet.fr>
Subject: Correctly processing foreign accents in CGIs
Message-Id: <3ACACCBD.4C2C4CDF@club-internet.fr>
Does anyone know how to make Perl correctly process foreign characters
coming from HTML forms? If, say, users have typed names with accented
characters in a form, the accented characters usually end up as garbage
in Perl scripts. I would like e-acutes to end up as e-acutes in my Perl
scripts, e-graves as e-graves in my scripts... Do I need to use Unicode?
Many thanks.
Philippe de Rochambeau
------------------------------
Date: Wed, 04 Apr 2001 07:42:30 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Correctly processing foreign accents in CGIs
Message-Id: <slrn9clk3t.6kt.rgarciasuarez@rafael.kazibao.net>
Philippe de Rochambeau wrote in comp.lang.perl.misc:
> Does anyone know how to make Perl correctly process foreign characters
> coming from HTML forms? If, say, users have typed names with accented
> characters in a form, the accented characters usually end up as garbage
> in Perl scripts. I would like e-acutes to end up as e-acutes in my Perl
> scripts, e-graves as e-graves in my scripts... Do I need to use Unicode?
Define 'garbage'. Are you speaking about the URL encoding of values
(e.g. é --> %E9) ? In this case, I see that you are not using the
CGI.pm module. You definitively should.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Wed, 04 Apr 2001 11:01:00 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: Correctly processing foreign accents in CGIs
Message-Id: <3ACAF0DC.198F9194@schaffhausen.de>
Philippe de Rochambeau schrieb:
>
> Does anyone know how to make Perl correctly process foreign characters
> coming from HTML forms? If, say, users have typed names with accented
> characters in a form, the accented characters usually end up as garbage
> in Perl scripts. I would like e-acutes to end up as e-acutes in my Perl
> scripts, e-graves as e-graves in my scripts... Do I need to use Unicode?
no, you need to replace the chars with their html entities. But beware
of the &
respectively &
->malte
------------------------------
Date: Wed, 4 Apr 2001 14:04:04 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Correctly processing foreign accents in CGIs
Message-Id: <Pine.LNX.4.30.0104041340130.25578-100000@lxplus003.cern.ch>
On Wed, 4 Apr 2001, Malte Ubl wrote:
> Philippe de Rochambeau schrieb:
> >
> > Does anyone know how to make Perl correctly process foreign characters
> > coming from HTML forms? If, say, users have typed names with accented
> > characters in a form, the accented characters usually end up as garbage
> > in Perl scripts.
No, they don't. They are encoded, just as documented in the
specifications. A module such as CGI.pm contains functions for
decoding them accordingly. This isn't really a Perl question - you've
got to understand the principles of what you are doing (which would be
on-topic on comp.infosystems.www.authoring.cgi) before there is any
real point in asking about how to do that in Perl.
> > I would like e-acutes to end up as e-acutes in my Perl
> > scripts, e-graves as e-graves in my scripts...
I don't think Perl cares in the least what the data octets represent.
It's up to you, the programmer, to give them meaning.
> Do I need to use Unicode?
In HTML you are using Unicode (as the Document Character Set) all of
the time, whether you like it or not. This is the wrong question to
ask, and until you understand why it's the wrong question to ask,
you're going to be stumbling around. I'm sorry to be so frank, but
I've seen this so many times before and I'd like to get you started on
the right foot rather than stumbling around.
I think you meant to ask something like "should I represent my HTML
document by using one of the Unicode character codings, such as
utf-8?", to which the answer is "maybe, but not necessarily".
> no, you need to replace the chars with their html entities.
Absolutely wrong - you do not _need_ to "replace" them. You _might_
find it convenient to do so, but you don't _need_ to do it (except for
the HTML-significant characters, i.e & < and in certain
contexts > and " ).
In HTML there are three valid ways to represent a character: the coded
character itself (i.e the octet or series of octets which represents
the character in the document's chosen character coding[1], be it
iso-8859-1 or utf-8 or whatever); or the &#number; representation of
its Unicode value; or (where available) the &name; of its character
entity. All three are valid representations of characters in HTML:
they differ in their convenience of use.
> But beware of the & respectively &
Obviously, and the other HTML-significant characters (a total of
four). But this isn't relevant to any other characters, and has
nothing directly to do with accented letters.
There are some relevant pages in
http://ppewww.ph.gla.ac.uk/~flavell/charset/
see particularly http://ppewww.ph.gla.ac.uk/~flavell/charset/checklist
http://ppewww.ph.gla.ac.uk/~flavell/charset/quick
and in the context of form submission
http://ppewww.ph.gla.ac.uk/~flavell/charset/form-i18n.html
I repeat, none of this is about Perl or specific to Perl, but until
one understands these underlying issues in enough detail, it's
pointless to ask how to do the task in Perl.
[f'ups set]
[1] Note that what is nowadays properly called the "character coding"
is represented by what MIME calls the "charset" attribute. Do not
confuse this with the term "character set", which in SGML/XML contexts
means something fundamentally different.
------------------------------
Date: Wed, 04 Apr 2001 12:25:28 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Deleting one line from a file
Message-Id: <3acb0f45.122824435@news.erols.com>
On Wed, 4 Apr 2001 21:26:14 +1000, David Findlay
<david_j_findlay@yahoo.com.au> wrote:
>I have attached the code here.
Ouch.
Never encode or attach files. Cut and paste code into the body of the
message.
Never post an entire program. Trim the code down to only the section
that is causing trouble. You have almost a hundred lines here, and
most of them are doing nothing but reading/writing files.
Don't make these mistakes again.
Learn exactly what 'push' does. He should introduce you to his pals
'pop', 'shift' and 'unshift'. They're your best friends when working
with arrays. Writing code like this is absurd.
> $tempLineCount++;
> $tempLines[$tempLineCount] = $_;
Write that instead as
push @tempLines, $_;
In fact, from a cursory glance, all this nonsense with
reading/assigning an array element then incrementing an index could be
one cause of your trouble.
> $tempLineCount = 1;
[Insert standard lecture on why you should have a good reason for not
starting an array at index 0.]
...
> while(<CLIENTS>) {
> $outLine = $_;
> $match = 0;
> foreach ($tempLines) {
That looks like a mistake itself.
You surely meant 'foreach (@tempLines)'.
use strict; would have caught that one for you. [Subtle hint.]
> if ($outLine eq $tempLines[$tempLineCount]) {
A bit of overkill, no?
The value of $tempLines[$tempLineCount] would already be assigned to
$_ by the foreach. (The value you are expecting, that is, if we
overlook the previously mentioned typo and the botched indexing that
will be mentioned in a moment.)
> $match = 1;
> }
> $tempLineCount++;
> }
You're continuously incrementing $tempLineCount, but it doesn't get
reset back to 1 when the next line is read from CLIENTS.
> if ($match != 1) {
That's not wrong, but it's a good opportunity to introduce 'unless'.
> print NEWCLIENTS $outLine;
> }
> }
Recast that whole chunk of code as
while(my $outLine = <CLIENTS>) {
my $match = 0;
foreach (@tempLines) {
$match = 1 if ($outLine eq $_);
}
print NEWCLIENTS $outLine unless $match;
}
To sum up, every instance of $tempLineCount should be eliminated. Add
elements to an array with push, and iterate over all elements in an
array with foreach.
------------------------------
Date: Wed, 04 Apr 2001 07:29:01 GMT
From: Chandramohan Neelakantan<cmon_209@hotmail.com>
Subject: Difference between $! and $@
Message-Id: <13Ay6.1267$jz.109482@www.newsranger.com>
Hi.
Are $! and $@ set based on the type of function being called?
For e.g we check $@ for exception handling and $! is used for errors in Signal
handling.
What I am looking for is a general guideline that can help me print the right
variable ($! or $@) to display Error/Warning messages.
Many Thanks
regards
Chandramohan Neelakantan
------------------------------
Date: Wed, 04 Apr 2001 07:56:25 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Difference between $! and $@
Message-Id: <slrn9clku0.6ql.rgarciasuarez@rafael.kazibao.net>
Chandramohan Neelakantan wrote in comp.lang.perl.misc:
> Hi.
>
> Are $! and $@ set based on the type of function being called?
No.
> For e.g we check $@ for exception handling and $! is used for errors in Signal
> handling.
>
> What I am looking for is a general guideline that can help me print the right
> variable ($! or $@) to display Error/Warning messages.
See the "Error Indicators" section in the perlvar document. Also the
description of $! and $@ in the same document.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Wed, 04 Apr 2001 06:18:51 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: fetch CGI::Cookie trouble...
Message-Id: <slrn9clf72.692.rgarciasuarez@rafael.kazibao.net>
phantom@yukonmfg.com wrote in comp.lang.perl.misc:
> Hello,
>
> I am having following problem: After successfully creating the cookie named
> 'KooKee' (I can see it in IE and Netscape), I want now to read its values,
> let's say I want to read the 'pass' and 'pref2' values. This cookie should
> have the 'pass' value 'mypass123' and 'pref2' = 2. Below you can see both
> pieces of script I was using to both create and read the cookie.
> How do I need to write my second script (the read script) in order to get all
> or some values of this multivalued cookie??
> It is my first attempt to write/read cookies..
> Don't laugh :) Bloody newbie, I know... :)
>
[.....]
>
> the following piece of script is supposed to read the cookie:
> ----------------------------------------------------------------
> #!/usr/bin/perl
While we're discussing your code, you should enable warnings (-w) and
use strict here. This is very useful, esp. when debugging.
> use CGI;
> use CGI::Cookie;
>
> #retreive cookie
> %cookies = fetch CGI::Cookie;
>
> #the code line below only reads the first value of the cookie,
> #in this case the output was: "Blah :) i01"
> $hmmm = $cookies{'KooKee'}->value;
> #what can I change here to get the 'pass' and the 'pref2' values instead?
List context :
my @values = $cookies{'KooKee'}->value(['pass','pref2']);
> Any help is more than welcome.. Couldn't find anything on the web, or maybe I
> was searching the wrong places.
The manpage for CGI::Cookie has the answer.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/perl/biscuit.html
------------------------------
Date: Wed, 04 Apr 2001 09:45:57 +0200
From: Ronald Fischer <ronald.fischer.gp@icn.siemens.de>
Subject: Re: How do I combine these
Message-Id: <3ACAD135.E80C6271@icn.siemens.de>
hue micheal wrote:
>
> How do I combine this into one statement ?
> $_ =~ s/[\t\s]+//g; # Remove spaces, tabs
> $_ =~ s/#.*$//; # Remove commenst on the same line, such as this
> line
s/[\t\s]+|#.*$//;
Ronald
--
Ronald Otto Valentin Fischer <rovf @ earthling . net>
[now at: Siemens ICM N MR UR DE 6, phone: +49(Germany)+89-722-23368]
http://profiles.yahoo.com/ronny_fischer/
http://fusshuhn.ourfamily.com/cppincomp.html
------------------------------
Date: Wed, 4 Apr 2001 05:43:05 -0400
From: "Prasad, Victor [FITZ:K500:EXCH]" <vprasad@americasm01.nt.com>
Subject: Multiple email send?vvp
Message-Id: <9aeqfc$o3$1@bcarh8ab.ca.nortel.com>
I have a list of 20 000 people who a monthly email.
I am going to do something like this but loop through 20 000 users:
#!/usr/bin/perl -w
use strict;
use Mail::Mailer;
my $mailer = new Mail::Mailer;
# the open() method takes a hash reference with keys which are mail
# header names and values which are the values of those mail headers
$mailer->open( {
From => 'fred@example.com',
To => 'barney@example.com',
Subject => 'Web form submission'
} );
# we can print to $mailer just as we would print to STDOUT or any
# other file handle...
print $mailer qq(
Dear Barney,
Here is a form submission from your website:
Name: $name
Email: $email
Comments: $comments
Love, Fred.
);
$mailer->close();
1) Will there be problem with sending this volume of email? Is a delay
required per email?
2) Is there a limit to the size of the message I am sending? if the data
inside the body is about a page or two will the 'qq (<data>) hold it?
3) Is it possible to send attachments.
Thank you,
V
------------------------------
Date: Wed, 04 Apr 2001 04:40:51 -0700
From: A_Geekette <moiraine{NOSPAM}@qwest.net>
Subject: Re: Newbies welcome
Message-Id: <3ACB0843.24346AEE@qwest.net>
Chris Stith wrote:
> In comp.lang.perl.misc Tracy Coyle <tccoyle@chorus.net> wrote:
> > Chris Stith wrote in message ...
>
> >>>>Do not ever be afraid of asking a question...
> >>
> >>Except when it's already answered for you.
>
> > $t = "SELECT * FROM sessiontable WHERE pageID = $page";
>
> > I apologize for using a php/mysql example but I spent 3 hours trying to find
> > out why this query was not working. I reviewed both php and mysql
> > documentation til my head hurt. First rule of programming...if it doesn't
> > work, check the syntax (but that is not in the FAQ...)
>
> No, but it's as obvious as checking the cable when you can't ping
> your router.
>
> >>> who was the brain that thought giving programmers access to manipulating
> >>> memory directly was a good idea??!! Moved to Java....someone
> > recommended
> >>
> >>Those who _need_ to access memory directly in programs, such as
> >>driver programmers, OS programmers, embedded device programmers, etc
> >>think dirct memory access is a good idea.
>
> > So you would agree giving that type of memory access to someone on a remote
> > machine is not a good idea? I believe that manipulating memory on the
> > machine the code resides on is acceptable, sometimes desirable, even
> > occasionally necessary.
>
> Who's talking about giving people the ability to do direct memory access
> from a remote machine? Last time I checked, C++ and the sort had to be
> compiled, and ran on one machine at a time. It's a pain to coerce C++
> to evaluate code on the fly, so I don't know what you're trying to say.
>
> >>> This newsgroup, like the others crossposted are excellant places to learn
> >>> and teach.
> >>
> >>To learn and teach what is not already taught in the FAQs. When you
> >>learn at a university, there are these things called `prerequisite
> >>courses', but I guess for you that means universities are bad places
> >>to learn.
>
> > I am unsure how you make this assumption (remote memory manipulation maybe!)
> > but I think universities are fine places to learn. Unfortunately, many
> > people have lives and responsibilities and can not return to school to learn
> > new tasks/skills. When I was in college, they taught COBOL and RPG II.
> > Java, C did not exist and the internet was still in its not-so-public
> > infancy.
>
> The analogy I was making is that if you hate the idea of a newsgroup
> having preqrequisites, then you are just as likely to hate the idea
> that you can't study nuclear medicine without first studying biology
> and chemistry.
>
> > And despite the excellant resources I have found for working with mysql and
> > php, my experience is that the simplist questions are "so obvious" that no
> > one addresses them formally. And you miss the point of FAQ's (frequently
> > asked questions)...they don't teach anything....they answer specific
> > questions....what if you don't know the right question...??
>
> I miss no point about FAQs. You make too many assumptions. You should
> read a book or the standard non-FAQ docs with the software before you
> look in the FAQ. You should then check the FAQ for a question before
> you ask the question here. Prerequisites are prerequisites.
>
> >>> To those that answer, thank you. To those that post, there are
> >>> others just like you out here, to those that lurk and learn, no question
> > is
> >>> stupid to the 50 others with the same question...
> >>
> >>The questions in the FAQs aren't stupid. No one says they are, otherwise
> >>they'd probably not be in the FAQ. It's perfectly acceptable to not know
> >>the answer to a question that's in a FAQ list. What's not acceptable is
> >>to ask several hundred or a few thousand people to answer the same
> >>question that was answered yesterday or that was answered on your hard
> >>drive all along.
>
> > Even you suggest 'stupid' questions "probably not be in the FAQ"....how do
> > you know a stupid question? You know the answer? Sorry, but freshmen do
> > not always know as much as seniors....if you don't like the questions
> > freshmen ask....don't read them.
>
> If it's not in the FAQ, then no one will tell you to go read the FAQ when
> you ask it. If it really is too simple to be in the FAQ, then it's probably
> been asked enough that it will be. If it is in the FAQ and you've checked
> the FAQ, you won't need to ask it here. It's really that simple. They are
> called Frequently Asked Questions because they are.
No documentation on a subject covers every detail of that subject. Take sendmail
for instance. 'nough said.
So, how about this. I'll ask you a question and you tell me where I'd find the
answer.
Where can I find a good Perl programmed web mail server?
Or this one?
How exactly do I tell my mail server that the email it just recieved for a user
that's
not in /etc/passwd, is intended for a web user that, for security purposes, do
not have shell access. (Since this isn't exactly Perl related in of itself...)
What
set of mods would I use and what would the best way be to program this in Perl?
> Here you infer that I'm a college senior. I haven't been in college for
> over five years, thanks.
> >>I have set followups to where this thread belongs: alt.dev.null;
> >>I would have used alt.horse.dead.beating, but StuporNews doesn't
> >>seem to carry that.
>
> > Obviously you have missed the intent of the thread...to welcome newbies....
>
> The intent of the thread is to inform people new to Usenet or to certain
> groups that no sort of manners is expected of them. The thread repeatedly
> states that it's okay to ask the same questions that ar ein the FAQs, that
> it's okay not to read documentation, and that anyone who asks you to do
> such things is just being rude. Read the thread. Know what the thread says.
> Then maybe you can try to say the thread isn't trying to tear down all the
> expectations of common courtesy expected on Usenet. When you do make such
> a statement, those who have read along at home will be able to judge the
> truth in your statements for themselves.
You know...this lady sounds like she has a lot of background in the whole
programming thing. I'd stop to consider where she's coming from before
discrediting her comments as idly as you.
>
> --
> Christopher E. Stith
> If they can get you asking the wrong questions, they don't
> have to worry about the answers.
> -- Thomas Pynchon, Gravity's Rainbow
Here are some facts for you:
1) It's difficult to wade through 1000 or so posts for the answer to a question.
2) Searching via sites like dejanews is difficult, because there are either too
many articles found or too little. To search for something, you often need more
knowledge than you have to find what you need.
3) If the question has been answered, point to questioner to where they kind find
the answer. Oh yes, make sure the reference acutally works.
Do you know what a newsgroup is for? It's for communication. It's for people
who have common interests to discuss them. One of the topics of conversation is
a problem that someone is having. A lot of times, people just need an alternate
perspective, because they've been working on a problem for a week straight
without any real social contact so are going insane not to mention berrating
themselves for not figuring out something they're sure is a simple problem and
have to get it done now because they have an arrogant know-it-all slimball of a
boss breathing down their neck telling them how to do their job when the boss
knows next to nothing about the subject matter the boss is telling you about
..................
So, kindly take your arrogant, superior, freaking attitude and shove it somewhere
mildly to extremely uncomfortable...prefereably your prosterior, but any orifice
will do.
--
Geekette
"Try Not. Do or do not. There is no try."
-If you don't know who said this,
I don't want to talk to you. ;-)
"Nothing is impossible, no matter how improbable."
-Anonymous
------------------------------
Date: Wed, 04 Apr 2001 12:39:54 +0200
From: Ronald Fischer <ronald.fischer.gp@icn.siemens.de>
Subject: Partly solved (was: pod2man says: bad option in paragraph)
Message-Id: <3ACAF9FA.7A0DBDC5@icn.siemens.de>
Ronald Fischer wrote:
>
> One paragraph in my POD section has a sentence that starts with
>
> "For example, the notation -p(attern) means ..." etc.
>
> pod2man does not like the leading hyphen, and it complains:
>
> /usr/local/bin/pod2man: bad option in paragraph 10 ... : ``-I'' should
> be [CB]<-I>
>
> Which is somewhat strange, as there is no "-I" at all. When I remove the
> hyphen, everything is fine.
I found the section in the pod2man man page which states that words
should not start with a hyphen (I overlooked it in my first reading).
Still I am surprised that pod2man complains about -I, not -p....
--
Ronald Otto Valentin Fischer < rovf @ earthling . net >
[now at: Siemens ICM N MR UR DE 6, phone: +49(Germany)+89-722-23368]
http://profiles.yahoo.com/ronny_fischer/
http://fusshuhn.ourfamily.com/cppincomp.html
------------------------------
Date: Wed, 04 Apr 2001 11:19:07 +0200
From: Keld Wesenberg =?iso-8859-1?Q?Lyngs=F8?= <kwl@pine.dk>
Subject: perl core dump with ill. instruction rlwinm on AIX4.3
Message-Id: <3ACAE70B.EB8C5799@pine.dk>
Hello,
I'm running a perl script on a Aix4.3 box, however sometimes perl core
dumps.
When investigating the core file I obtain the information below.
Does anyone know what causes this and how to solve it.
Thanks in advance.
Keld
$dbx /usr/local/bin/perl5.00503 core
Type 'help' for help.
reading symbolic information ...warning: no source compiled with -g
[using memory image in core.perl]
Illegal instruction (reserved addressing fault) in . at 0x0 ($t1)
0x00000000 5543532d rlwinm. r3,r10,0xa,0xc,0x16
(dbx) where
warning: could not locate trace table from starting address 0x0
warning: could not locate trace table from starting address 0x1ab48
warning: could not locate trace table from starting address 0x44c0
warning: Could not determine current function
------------------------------
Date: 4 Apr 2001 10:11:51 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perl Tutorial "Program Repair Shop and Red Flags" 23 April 2001
Message-Id: <9aes17$knl$1@mamenchi.zrz.TU-Berlin.DE>
Keywords: Millie, annum, omniscient, ye
[posted and mailed]
According to Mark Jason Dominus <mjd@plover.com>:
[...]
> Here's the brochure description:
[...]
> He is the managing editor of www.perl.com, a moderator of the
> comp.lang.perl.misc newsgroup, ...
Now how did that slip in?
Anno
------------------------------
Date: 4 Apr 2001 07:18:35 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: Please Flame my Benchmark: open vs. cat
Message-Id: <slrn9climb.av5.vek@pharmnl.ohout.pharmapartners.nl>
On 03 Apr 2001 14:36:45 -0500, Ren Maddox <ren@tivoli.com> wrote:
>
>Of course, in the *real* version I would want it to have error
>handling, the ability to slurp multiple files, etc. :)
>
In the real world it is a bit difficult to get reliable error checking
with the cat function. At best you can check the exit code from cat
with the $? variable plus maybe trap the stderr from the cat command
for possible error messages.
Villy
------------------------------
Date: Wed, 4 Apr 2001 10:11:13 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Please Flame my Benchmark: open vs. cat
Message-Id: <slrn9clsq1.fo2.abigail@tsathoggua.rlyeh.net>
Dave Bailey (dave@sydney.daveb.net) wrote on MMDCCLXXIII September
MCMXCIII in <URL:news:slrn9cklep.71p.dave@sydney.daveb.net>:
;; On Tue, 03 Apr 2001 23:46:13 -0000, Chris Stith
;; <mischief@velma.motion.net> wrote:
;; >Dave Bailey <dave@sydney.daveb.net> wrote:
;; >> On Tue, 3 Apr 2001 20:34:07 +0000 (UTC), Abigail <abigail@foad.org> wrote:
;; >>>Uri Guttman (uri@sysarch.com) wrote on MMDCCLXXII September MCMXCIII in
;; >>><URL:news:x78zlhvs70.fsf@home.sysarch.com>:
;; >>>;; >>>>> "A" == Abigail <abigail@foad.org> writes:
;; >>>;;
;; >>>;; A> I find the Benchmark not very useful. One doesn't repeatedly read
;; >>>;; A> the same file over and over again in a typical program.
;; >>>;;
;; >>>;; A> Furthermore, you are banchmarking the repeat read of a single
;; >>>;; A> file. A good Benchmark would bench a whole range of file sizes
;; >> [...]
;; >
;; >[snip]
;; >
;; >>>If I need a string 10,000 times in a program, I would not read it
;; >>>10,000 times from a file and benchmark which is the fastest.
;; >>>
;; >>>I'd redesign my program to something less absurd.
;; >
;; >> Your posts indicate that you don't understand what a benchmark is, nor
;; >> do you understand why the poster originally wrote this particular one.
;; >
;; >That is a pretty drastic conclusion to draw from such little context.
;; >This is especially true since Abigail is one of the more respected
;; >regulars in the group.
;;
;; Not really. Most people misuse and/or misinterpret benchmarks, in
;; addition to merely creating useless ones.
;;
;; >The fact that Abigail doesn't think it's normal to read the same
;; >file for contents several thousand times in a program doesn't mean
;; >she doesn't recognize the value of a benchmark.
;;
;; I didn't say that. I was referring to her implication that the program
;; which inspired the benchmark did this ("If I need a string 10,000 times
;; in a program..."), and should be redesigned. That was never indicated
;; by the original poster. Perhaps all the program did was slurp a file
;; into a scalar and then exit. It doesn't matter. The question was, is it
;; faster to perform this task by backticking cat, or by slurping from Perl?
But the benchmark doesn't give you a quantitative answer. Because of the
10,000 iterations, 9,999 measure something else.
For a single read, the difference between a backticked cat and slurping
from Perl is as irrelevant as the question how many angles can dance on
the tip of a needle. Because the time will be dominated by the disk read.
;; >She just thinks the benchmark is silly, considering the task isn't one
;; >that will be done in any real program...
;;
;; The repetition merely serves to magnify the time difference between the
;; two methods to the point where it is resolvable. There is no implication
;; that this would occur in a "real" program. Suppose I write a benchmark to
;; compare floating point multiplication with floating point division to
;; convince someone that the former is faster. There are lots of situations
;; in computational physics where the inner loop of a computation includes
;; a division by something (say, x) which is computed in an outer loop. Such
;; a computation can be made faster by computing the reciprocal of x (call it
;; y) in the outer loop and replacing the inner-loop division by x with a
;; multiplication by y. Depending on what's going on in the inner loop, the
;; savings can be quite substantial. But the benchmark itself might be very
;; unnatural and you might look at it and say "I would never write a program
;; which does this. I would redesign my program instead". But the program
;; in question isn't the benchmark, it's the computation which had the division
;; in the inner loop. You can't always just redesign things like that.
Keyword "inner loop". Any program that does the same operation repeatedly
in an inner loop has something that can be optimized away. That optimization
even has an official name: "Loop enlightment". Programming 101.
The best optimization of a loop is to take things *out* of a loop.
;; >I think if you want to know the difference between cat and open in
;; >this controlled environment, the benchmark is fine. If you want to
;; >measure real-world performance, you need to do as Abigail suggests
;; >by feeding it several hundred or a few thousand different files.
;; >In the latter case, you need to remember that you're benchmarking
;; >your disk susbsystem more than your program. If you want the benchmark
;; >to be more relevant, it needs to be rewritten to do something a real
;; >program is likely to do.
;;
;; I believe that "real-world performance" and "benchmark" are, necessarily,
;; contradictions. This is the crux of my disagreement with you and Abigail.
;; A benchmark which measures some inscrutable combination of many different
;; things tells me much less than several benchmarks, each of which measures
;; a specific thing. In the case where you read hundreds of thousands
;; of different files by cat and by open, you're testing your file system,
;; your kernel, various system calls, and your malloc implementation (cat
;; allocates memory for input and output buffers). I think this is overkill.
;; cat and open are not going to differ at all in certain respects such as
;; the file system's efficiency, so why is it necessary to have files all over
;; the disk in *this comparison*? All this does is dilute the difference
;; between the two methods by adding a constant time to both tests. As for
;; using different size files, that depends on the program which inspired the
;; benchmark. What if all the files are the same size? What if it's the same
;; exact file on the same exact loction in disk, but it gets rewritten every
;; 5 seconds by some other process? You can't just blindly say, "this is
;; what you need to do to get a realistic benchmark", because what's realistic
;; varies from one situation to the next.
I always say "Benchmarking is an art". It's probably harder, and it certainly
is less understood that programming in general.
And an analysis is always better than a benchmark.
Abigail
--
tie $" => A; $, = " "; $\ = "\n"; @a = ("") x 2; print map {"@a"} 1 .. 4;
sub A::TIESCALAR {bless \my $A => A} # Yet Another silly JAPH by Abigail
sub A::FETCH {@q = qw /Just Another Perl Hacker/ unless @q; shift @q}
------------------------------
Date: Wed, 4 Apr 2001 10:13:34 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Please Flame my Benchmark: open vs. cat
Message-Id: <slrn9clsue.fo2.abigail@tsathoggua.rlyeh.net>
Dave Bailey (dave@sydney.daveb.net) wrote on MMDCCLXXIII September
MCMXCIII in <URL:news:slrn9cl1o4.7hg.dave@sydney.daveb.net>:
``
`` >Perhaps if you could show me that opening a number of different sized
`` >files spread over different disks showed a consisitent noticable speed
`` >increase, then that would be a worthwhile benchmark. Oh wait, that was
`` >what Abigail was saying before now wasn't it?
``
`` That doesn't isolate the difference between the two methods, it merely
`` adds a constant to the elapsed time for both tests, which washes out the
`` comparison and renders the benchmark useless.
Yes, it does add a constant time. A very important constant time, one
that makes the ratio between the measured times far, far less.
And that's entirely my point.
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
------------------------------
Date: Wed, 04 Apr 2001 10:22:54 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Please Flame my Benchmark: open vs. cat
Message-Id: <slrn9cltfs.rre.tjla@thislove.dyndns.org>
I was shocked! How could Dave Bailey <dave@sydney.daveb.net>
say such a terrible thing:
>No. People do tests like this all the time when benchmarking kernel
>system calls. See http://www.kegel.com/dkftpbench/Poller_bench.html
>for an example.
Yeah but that's realistic for kernel system calls. See, kernel system
calls can be called over and over again with the same arguments. The
whole point of the kernel is after all to run as fast as possible. Even
so, I bet they don't benchmark open(2) and read(2) with the same
arguments over and over again, unless they are trying to figure out how
well the cache performs.
>>Perhaps if you could show me that opening a number of different sized
>>files spread over different disks showed a consisitent noticable speed
>>increase, then that would be a worthwhile benchmark. Oh wait, that was
>>what Abigail was saying before now wasn't it?
>
>That doesn't isolate the difference between the two methods, it merely
>adds a constant to the elapsed time for both tests, which washes out the
>comparison and renders the benchmark useless.
Well my contention is the benchmark was already useless so nothing is
lost or gained. The purpose of a benchmark is to provide some sort of
estimate of how well a system would perform in real-life. Opening and
reading in the same file over and over again is not realistic. If you
have to do it 1000 times to tell the difference, then maybe there is no
difference. The OP posted a benchmark with the exact words "Please flame
my benchmark." Consider it duly flamed.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
If time heals all wounds, how come the belly button stays the same?
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 625
**************************************