[20017] in Perl-Users-Digest
Perl-Users Digest, Issue: 2212 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 26 18:10:47 2001
Date: Mon, 26 Nov 2001 15:10:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1006816211-v10-i2212@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 26 Nov 2001 Volume: 10 Number: 2212
Today's topics:
Re: RTFM (was Re: A Perl Bug?) (Randal L. Schwartz)
Re: RTFM (was Re: A Perl Bug?) <jake@chaogic.com>
Re: RTFM (was Re: A Perl Bug?) <ellem@techie.net>
Re: RTFM (was Re: A Perl Bug?) (Randal L. Schwartz)
Re: RTFM (was Re: A Perl Bug?) <godzilla@stomp.stomp.tokyo>
Re: RTFM (was Re: A Perl Bug?) <bart.lateur@pandora.be>
Re: Serious Regexp help... (Garry Williams)
Re: Serious Regexp help... (Garry Williams)
Re: Still having trouble.. <stuart@otenet.gr>
Re: Still having trouble.. <stuart@otenet.gr>
Re: System call return value 256 - Bad file descriptor (Bryce Pursley)
Re: System call return value 256 - Bad file descriptor <godzilla@stomp.stomp.tokyo>
Re: Top-posts (Randal L. Schwartz)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 Nov 2001 11:54:24 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: RTFM (was Re: A Perl Bug?)
Message-Id: <m1adx9i9zj.fsf@halfdome.holdit.com>
>>>>> "Lou" == Lou Moran <ellem@techie.net> writes:
Lou> CLPM Folks -- PLease remember hardly any of us asking questions know
Lou> what you do... And chances are we don't even know another "real"
Lou> programming language.
But you speak this like there's an *obligation* to help someone
*nicely* when they post a question here. I argue that there's no such
obligation. I will not deny that when *many* folks post questions
here, the regulars nicely respond with appropriate answers. However,
there is NO RIGHT TO EXPECT ANSWERS here. That's why this IS NOT A
HELP DESK.
This is a community conversation area. Sure, questions get answered,
but more likely, discussions get discussed. If you wander in here
with the wrong attitude (like "you owe me the answer to this"), you
*will* get nailed for misapproriate use of the resource! I can't see
why this is so hard to figure out, or simply observe over time!
use My::Fixcase; print fixcase("just another perl hacker,") # :-)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Mon, 26 Nov 2001 15:43:26 -0600
From: "Jake Fan" <jake@chaogic.com>
Subject: Re: RTFM (was Re: A Perl Bug?)
Message-Id: <9tud2k$cqf$1@Masala.CC.UH.EDU>
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
> with the wrong attitude (like "you owe me the answer to this"), you
> *will* get nailed for misapproriate use of the resource!
I was wondering, who has the authority over "the resource"? I know Perl
itself is GPL'ed so I don't have to worry about anyone ripping off my right
of using Perl as a programming language, not even Larry Wall (not that he
would). But as far as this news group is concerned, until someone tells me
who/what/where the ownership belongs to, I will continue to assume that it
is a public forum. So fair enough, go nail around all you want. But by the
very same principle, if you come in with the knee jerk wrong attitude like
"you moron should do this, you idiot shouldn't do that", you will also get
protested. This probably does not happen as often since most casual
visitors who got bullied would simply call it bad luck and move on, but it
shouldn't make you think that you own the turf just because you are a
regular of the group. Come to think of it, this problem isn't unique to
this group at all. Many other Usenet groups are plagued by this attitude
problem caused by the regulars.
On a bright note, this is overall a great group. I have had much benefit
simply by lurking around. Many regulars have proven to be very
knowledgeable and helpful, even those with attitudes. And for that, I say,
thank you.
------------------------------
Date: Mon, 26 Nov 2001 16:55:10 -0500
From: Lou Moran <ellem@techie.net>
Subject: Re: RTFM (was Re: A Perl Bug?)
Message-Id: <vid50uk376cur2suu2le817tgu8rj5oj5b@4ax.com>
On 26 Nov 2001 11:54:24 -0800, merlyn@stonehenge.com (Randal L.
Schwartz) wrote wonderful things about sparkplugs:
>>>>>> "Lou" == Lou Moran <ellem@techie.net> writes:
>
>Lou> CLPM Folks -- PLease remember hardly any of us asking questions know
>Lou> what you do... And chances are we don't even know another "real"
>Lou> programming language.
>
>But you speak this like there's an *obligation* to help someone
>*nicely* when they post a question here. I argue that there's no such
>obligation.
SNIP
Not my intent, and precisely why I recommend to the question askers go
to PerlMonks who seem more inclined towards answering the same
question over and over. (And where I have seen you answer a good deal
of questions.) My point was _supposed_ to be if you answer remember
that the person getting the answer may not understand you. Which
isn't the worst thing in the world b/c it will force the shy among us
to figure out what the answer means.
As for obligation, no one is ever obligated to do anything. I think
that if one goes to the trouble of answering a question they could
just point the asker in the right direction or outright answer the
question. Makes for happy newbies who may turn into the answerers of
the future, thus carrying the Perl... uh, hump?
>
>This is a community conversation area. Sure, questions get answered,
>but more likely, discussions get discussed. If you wander in here
>with the wrong attitude (like "you owe me the answer to this"), you
>*will* get nailed for misapproriate use of the resource! I can't see
>why this is so hard to figure out, or simply observe over time!
A great many posts here are: "I want to do this CGI thing and..."
followed by: "Don't top post, RTFM, perldoc -f CGI, This is not a Perl
question, it's Perl not PERL -- so observing here is not a splendid
thing. Even when the troll is laying low flames erupt.
I mentioned to Tad M once a long time ago that someday Top Posting and
bad netquitte will be the norm and I (ruefully) believe it. The Noise
Ratio here is very high. I still find it wildly entertaining and I
learn a lot here despite all the yelling.
--
TMTOWTDI: My way tends to be wrong...
lmoran@wtsg.com
------------------------------
Date: 26 Nov 2001 14:24:27 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: RTFM (was Re: A Perl Bug?)
Message-Id: <m1r8qldvc4.fsf@halfdome.holdit.com>
>>>>> "Jake" == Jake Fan <jake@chaogic.com> writes:
Jake> Come to think of it, this problem isn't unique to this group at
Jake> all. Many other Usenet groups are plagued by this attitude
Jake> problem caused by the regulars.
Hmm. And that should tell you something. You'd only call it
"attitude" if you disagreed with it. Perhaps there's something the
"regulars" are actually all agreeing on that is actually *useful*, but
you won't accept it as such because you have a minority differing
opinion?
Jake> On a bright note, this is overall a great group. I have had
Jake> much benefit simply by lurking around. Many regulars have
Jake> proven to be very knowledgeable and helpful, even those with
Jake> attitudes. And for that, I say, thank you.
And those very same regulars are also saying "for us to hang out answering
things here, we need YOU (the newcomers) to follow the rules that we've
found to work over our longer experience here".
We've already lost a lot of the old-school Perl experts to bad
newcomers. The ones of us that are left are just trying to beat the
same drum, although we're more die-hard.
If you want us to stick around, do it this way.
Otherwise, you newbies are on your own.
Simple enough?
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Mon, 26 Nov 2001 14:35:22 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: RTFM (was Re: A Perl Bug?)
Message-Id: <3C02C3AA.3F7A6A15@stomp.stomp.tokyo>
Lou Moran wrote:
> Randal L. Schwartz wrote:
> > Lou Moran wrote:
(snipped)
> A great many posts here are: "I want to do this CGI thing and..."
> followed by: "Don't top post, RTFM, perldoc -f CGI, This is not a Perl
> question, it's Perl not PERL -- so observing here is not a splendid
> thing. Even when the troll is laying low flames erupt.
Ah... but you boys are the trolls. This is quite self-evident.
> The Noise Ratio here is very high.
Obviously. You boys are trolls.
> I still find it wildly entertaining and I
> learn a lot here despite all the yelling.
So who is doing all the yelling? A rhetorical
question begging no answer. This answer is
equally self-evident; you boys are trolls.
* shrugs *
Such is reality about which you boys consistently lie.
Godzilla! Queen Of Truth Sayers.
------------------------------
Date: Mon, 26 Nov 2001 22:39:50 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: RTFM (was Re: A Perl Bug?)
Message-Id: <o4h50uot59igc587sone1evmk9dsqk5r8e@4ax.com>
Jake Fan wrote:
>Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>
>> with the wrong attitude (like "you owe me the answer to this"), you
>> *will* get nailed for misapproriate use of the resource!
>
>I was wondering, who has the authority over "the resource"?
Why, the people who bother to answer your questions, that's who. It's
*their* time your wasting.
--
Bart.
------------------------------
Date: Mon, 26 Nov 2001 22:13:32 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Serious Regexp help...
Message-Id: <slrna05fkj.16e.garry@zfw.zvolve.net>
On Mon, 26 Nov 2001 18:23:31 +1100, Andrew Hamm <ahamm@programmer.net>
wrote:
> Garry Williams wrote in message ...
>>
>> /^
>> (\S+) # $1 = 4x6
>> \s+
>> (\d+) # $2 = 1
>> \s+
>> (.*) # $3 = Standard Print...
>> ([.\d]+) # $4 = .75
>> \s+
>> (\$\d+\.\d+) # $5 = $0.75
>> $/x
>>
> Careful there - your (.*) is greedy and will consume all of the 2nd-last
> field, then the backtracking will give back ONE character so that the
> 2nd-last field is incorrectly matched. You've also neglected to discard the
> spaces between field #3 and #4.
I did mention that $3 would have trailing spaces. Your main point is
correct, however. (So $3 *will* contain some of that which is
intended to be captured into $4 -- in addition to the trailing
spaces.)
> Change to this and try again:
>
> /^
> (\S+) # $1 = 4x6
> \s+
> (\d+) # $2 = 1
> \s+
> (.*?) # $3 = Standard Print...
> \s+
> ([.\d]+) # $4 = .75
> \s+
> (\$\d+\.\d+) # $5 = $0.75
> $/x
>
> no, I haven't tested it either ;-) but it looks better.
I did and your correction is the ticket:
#!/usr/bin/perl -lw
use strict;
$, = "|";
while (<DATA>) {
print /^
(\S+) # $1 = 4x6
\s+
(\d+) # $2 = 1
\s+
(.*?) # $3 = Standard Print...
\s+
([.\d]+) # $4 = .75
\s+
(\$\d+\.\d+) # $5 = $0.75
$/x
}
__DATA__
4x6 1 4"x6" Standard Print (full-frame from 35mm) Image:Uploaded Image 1 .75 $0.75
4x6 1 4"x6" Standard Print (full-frame from 35mm) Image:Uploaded Image 2 .75 $0.75
5x7.5 1 5x7.5 Image:Uploaded Image 3 4.25 $4.25
8x12 1 8x12 Classic Full Frame Image:Uploaded Image 4 10.25 $10.25
$ perl try
4x6|1|4"x6" Standard Print (full-frame from 35mm) Image:Uploaded Image 1|.75|$0.75
4x6|1|4"x6" Standard Print (full-frame from 35mm) Image:Uploaded Image 2|.75|$0.75
5x7.5|1|5x7.5 Image:Uploaded Image 3|4.25|$4.25
8x12|1|8x12 Classic Full Frame Image:Uploaded Image 4|10.25|$10.25
$
--
Garry Williams
------------------------------
Date: Mon, 26 Nov 2001 22:29:19 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Serious Regexp help...
Message-Id: <slrna05gi8.16e.garry@zfw.zvolve.net>
On Mon, 26 Nov 2001 22:13:32 GMT, Garry Williams <garry@ifr.zvolve.net> wrote:
> On Mon, 26 Nov 2001 18:23:31 +1100, Andrew Hamm <ahamm@programmer.net>
> wrote:
>
>> Garry Williams wrote in message ...
[snip]
> #!/usr/bin/perl -lw
> use strict;
> $, = "|";
> while (<DATA>) {
> print /^
> (\S+) # $1 = 4x6
> \s+
> (\d+) # $2 = 1
> \s+
> (.*?) # $3 = Standard Print...
Non-greediness is really not necessary here because the next assertion
is `\s+' and it will force the backtracking to re-anchor correctly on
the last two "price" fields. Also, the next assertion will gobble up
all of the trailing space on the third field.
> \s+
> ([.\d]+) # $4 = .75
> \s+
> (\$\d+\.\d+) # $5 = $0.75
> $/x
> }
> __DATA__
> 4x6 1 4"x6" Standard Print (full-frame from 35mm) Image:Uploaded Image 1 .75 $0.75
> 4x6 1 4"x6" Standard Print (full-frame from 35mm) Image:Uploaded Image 2 .75 $0.75
> 5x7.5 1 5x7.5 Image:Uploaded Image 3 4.25 $4.25
> 8x12 1 8x12 Classic Full Frame Image:Uploaded Image 4 10.25 $10.25
>
> $ perl try
> 4x6|1|4"x6" Standard Print (full-frame from 35mm) Image:Uploaded Image 1|.75|$0.75
> 4x6|1|4"x6" Standard Print (full-frame from 35mm) Image:Uploaded Image 2|.75|$0.75
> 5x7.5|1|5x7.5 Image:Uploaded Image 3|4.25|$4.25
> 8x12|1|8x12 Classic Full Frame Image:Uploaded Image 4|10.25|$10.25
> $
>
--
Garry Williams
------------------------------
Date: Mon, 26 Nov 2001 23:50:22 +0200
From: "Stuart Gall" <stuart@otenet.gr>
Subject: Re: Still having trouble..
Message-Id: <9tudgk$nfs$1@usenet.otenet.gr>
"Jason Gray" <perl@cableone.net> wrote in message
news:u0448uehm1s0f3@corp.supernews.com...
> I'm still having trouble with creating a link for the next page results,
> here is my code to show the results. Any help with the link would be
> considerable.
>
> ($rs, $re) = getrange($#array, $page, 10);
>
> foreach my $i ($rs .. $re) {
> print $array[$i];
> }
>
> sub getrange {
> my ($num, $page, $perpage) = @_;
> my ($rs, $re);
<snip>
This seems very complicated.
What I do is have a CGI parameter offset
so you display 10 results then do
<a href="mycgi?bla bla bla&offset=10>next</a>
then you just do the same thing but ignore the first offset enteries
The next page has
<a href="mycgi?bla bla bla&offset=0>previous</a>
<a href="mycgi?bla bla bla&offset=20>next</a>
Dont muck about with page numbers.
so
$rs=$cgi->param('offset')+1
$re=$rs+10<$#array?$rs+10:$#array;
> foreach my $i ($rs .. $re) {
> print $array[$i];
> }
$pre=$rs>=10?$rs-10:0; # be a bit defensive in case some charley puts 5 in
offset
print qq{<a href="mycgi?bla bla bla&offset=$pre">previous</a>
<a href="mycgi?bla bla bla&offset=$re>next</a>};
If generating the list is expensive, you might save to a temporary file, and
then include a savefile= as a parameter. But this is very rarely necessary.
You need a cronjob to delete the temporary files, you need a method for
generating unique filenames with a large cycle time. Also if a file is
specified and it is no longer there you need to regenerate anyway.
Some search engines used to do this because the search would expire. But it
is a desperate technique, better to perfect your
skipping-offset-enteries-algorithm.
--
Stuart Gall
------------------------------------------------
This message is not provable.
------------------------------
Date: Tue, 27 Nov 2001 00:03:51 +0200
From: "Stuart Gall" <stuart@otenet.gr>
Subject: Re: Still having trouble..
Message-Id: <9tuecv$nrm$2@usenet.otenet.gr>
> $re=$rs+10<$#array?$rs+10:$#array;
or even
$re=$rs+9<$#array?$rs+9:$#array;
--
Stuart Gall
------------------------------------------------
This message is not provable.
------------------------------
Date: Mon, 26 Nov 2001 20:18:13 GMT
From: hbpursle@duke-energy.com (Bryce Pursley)
Subject: Re: System call return value 256 - Bad file descriptor
Message-Id: <3c03a117.20453951@news.infoave.net>
Yes I agree completely. I have followed that very line of questioning
down several avenues and have yet to come up with any useful replies.
So, in the meantime, I decided I'd see if someone could help me
understand a little better what "Bad file descriptor" might REALLY be
saying. That way, I might have a chance to fix this problem sooner
rather than later.
And beyond that, I can't think of anything that could change on a
"systemwide" scale that would affect every other file and not every
file. That's the real stumper for me.
I appreciate your comment and understand somewhat why it was made but
I would really appreciate some more helpful suggestions.
Bryce
On Mon, 26 Nov 2001 10:31:27 -0800, "Godzilla!"
<godzilla@stomp.stomp.tokyo> wrote:
>Bryce Pursley wrote:
>
>(snipped)
>
>> A line of code that has worked for over a month has all of a sudden
>> gone "intermittent." One day it won't work at all and the next day it
>> will work on every other file passed to it.
>
>
>Nothing else needs to be said. It is clear based on your
>statements something has changed. Either ascertain what
>you have changed or contact your server and ascertain
>what they have changed. Doing so will provide you with
>a clear definitive answer.
>
>
>Godzilla!
------------------------------
Date: Mon, 26 Nov 2001 12:58:20 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: System call return value 256 - Bad file descriptor
Message-Id: <3C02ACEC.DFE96196@stomp.stomp.tokyo>
Bryce Pursley wrote:
> Godzilla! wrote:
> >Bryce Pursley wrote:
(snipped - topic is a bad file descriptor error message)
> > > A line of code that has worked for over a month has all of a sudden
> > > gone "intermittent." One day it won't work at all and the next day it
> > > will work on every other file passed to it.
> > Nothing else needs to be said. It is clear based on your
> > statements something has changed. Either ascertain what
> > you have changed or contact your server and ascertain
> > what they have changed. Doing so will provide you with
> > a clear definitive answer.
> Yes I agree completely. I have followed that very line of questioning
> down several avenues and have yet to come up with any useful replies.
> So, in the meantime, I decided I'd see if someone could help me
> understand a little better what "Bad file descriptor" might REALLY be
> saying. That way, I might have a chance to fix this problem sooner
> rather than later.
A request borne of impatience is a personal quality I do not admire.
Your favorite internet search engine will return literally thousands
of links related to http protocal, socket protocal, redirect protocal,
open protocal, system open protocal and MAC system problems,
all and more, associated with a bad file descriptor.
With your impatience clearly displayed, I am surprised you have not
immediately begun researching and reading about this problem.
Godzilla!
------------------------------
Date: 26 Nov 2001 11:57:54 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Top-posts
Message-Id: <m1667xi9tp.fsf@halfdome.holdit.com>
>>>>> "Mark" == Mark <admin@asarian-host.net> writes:
Mark> Netiquette has no leading industry institution behind its
Mark> formation that lends it any formal authority. Netiquette is not
Mark> an RFC, for instance, and should not be treated with the same
Mark> authority. Since Netiquette is really no more than a collected
Mark> reflection of how things are currently, and predominantly, done,
Mark> that concept, by its very definition, does not preclude the
Mark> possibility for change -- any grinding of teeth despite. :) So,
Mark> he who concerns himself with Netiquette should always keep in
Mark> mind that Netiquette is dynamic.
You say that like you believe it is arbitrary though. It's not.
Top-posting is messy once replies are intermingled with questions, and
replies intermingled with questions have been found to work the best
over time.
So, it's not just about "proper". It's about "what works".
Just because a certain Redmond company put the default cursor ahead of
the quoted text doesn't mean that this is a better way of doing
things. Ask the people who have been involved in online communities
longer than that company has been in existance.
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
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 2212
***************************************