FAQ 8.29 Why can't my script read from STDIN after I gave it EOF (^D on Unix, ^Z on MS-DOS)?

P

PerlFAQ Server

This is an excerpt from the latest version perlfaq8.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

8.29: Why can't my script read from STDIN after I gave it EOF (^D on Unix, ^Z on MS-DOS)?

This happens only if your perl is compiled to use stdio instead of
perlio, which is the default. Some (maybe all?) stdios set error and eof
flags that you may need to clear. The "POSIX" module defines
"clearerr()" that you can use. That is the technically correct way to do
it. Here are some less reliable workarounds:

1 Try keeping around the seekpointer and go there, like this:

$where = tell(LOG);
seek(LOG, $where, 0);

2 If that doesn't work, try seeking to a different part of the file
and then back.

3 If that doesn't work, try seeking to a different part of the file,
reading something, and then seeking back.

4 If that doesn't work, give up on your stdio package and use sysread.



--------------------------------------------------------------------

The perlfaq-workers, a group of volunteers, maintain the perlfaq. They
are not necessarily experts in every domain where Perl might show up,
so please include as much information as possible and relevant in any
corrections. The perlfaq-workers also don't have access to every
operating system or platform, so please include relevant details for
corrections to examples that do not work on particular platforms.
Working code is greatly appreciated.

If you'd like to help maintain the perlfaq, see the details in
perlfaq.pod.
 
A

Andrzej Adam Filip

PerlFAQ Server said:
This is an excerpt from the latest version perlfaq8.pod, [...]

Could you limit rate of FAQ post flood to 25%-50% of all threads in the group?
 
K

Keith Keller

PerlFAQ Server said:
This is an excerpt from the latest version perlfaq8.pod, [...]

Could you limit rate of FAQ post flood to 25%-50% of all threads in the group?

What is the rationale for doing so? Can't you simply killfile on ^FAQ
or some such?

--keith
 
B

brian d foy

Andrzej Adam Filip said:
PerlFAQ Server said:
This is an excerpt from the latest version perlfaq8.pod, [...]

Could you limit rate of FAQ post flood to 25%-50% of all threads in the group?

I probably could spend a few hours to write a script that measures the
activity of the group and throttles the faq poster, but there are much
better things to do in life. If you don't want to see the FAQ, just
killfile them or score them down.

For what it's worth, this newsgroup is the reason that the FAQ is so
good. The readers in this group are the ones reporting most of the
errors, out-of-date examples, and other corrections. There's a lot of
benefit to posting the FAQs here, and there has been for years.
 
C

ccc31807

Could you limit rate of FAQ post flood to 25%-50% of all threads in the group?

The FAQ posts are, for me, a valuable resource for keeping up-to-date
with Perl. I have a habit of reading through the documentation,
although normally by work takes precedence so that I mostly in
dereliction of it. The FAQs remind me on a daily basis of things that
I don't know but should, and of those things that I have forgotten. I
know that I'm not the only one that reads these FAQ posts regularly,
and I appreciate having these posts appear regularly.

As a note, the percentage depends on the number of other posts, and
the percentage approaches 100 percent as other posts decline, and 0
percent as other posts increase. How can you determine a target
percentage when you don't control the other posts?

CC.
 
J

Justin C

In


Yes, but Shirley 1/month would be sufficient.

One FAQ per month or one posting of each FAQ per month? I hadn't noticed
that the FAQs were appearing more frequently than that anyway, there are
a lot of them, perhaps their number is leading you to believe they are
more frequent than you suggest?

Have a vote on it:
All those who can't or are too lazy to operate a KF and would
therefore like to see a reduction in FAQ postings say aye.

Justin.
 
R

Randal L. Schwartz

Justin> All those who can't or are too lazy to operate a KF and would
Justin> therefore like to see a reduction in FAQ postings say
Justin> aye.

All those who can't operate a kill filter surely (shirley?) can
unsubscribe from this newsgroup instead.
 
J

Jon Du Kim

I would hope that FAQ answers get reviewed/updated more frequently
than every 25 years!
oh horseshit! That retarded "posting faq" you spam the group with hasn't
been touched in, what? 10 years?
Why you put your name on it is beyond me. Do you really want an autoposted
whinging anti-social screed to be what comes up if anyone googles your name?
 
U

Uri Guttman

JDK> oh horseshit! That retarded "posting faq" you spam the group with
JDK> hasn't been touched in, what? 10 years? Why you put your name on
JDK> it is beyond me. Do you really want an autoposted whinging
JDK> anti-social screed to be what comes up if anyone googles your
JDK> name?

and this is what google will find for your name.

if you ever read any of the threads on the faq posts, you will see they
get patches and edits and bdf does apply them regularly. the issue is
perl isn't released so often that you see the changes right away. but
they do go in the next version.

uri
 
J

Jon Du Kim

if you ever read any of the threads on the faq posts, you will see they
get patches and edits and bdf does apply them regularly. the issue is
perl isn't released so often that you see the changes right away. but
they do go in the next version.
Once again you missed the point. I was referring to the "posting faq" Tad
autoposts. You know, where he whinges about how posting to c.l.p.m require
as much due diligence as an academic journal. *guffaw*
Put the bucket of hot chocolate down and do try to pay attention.
 
U

Uri Guttman

JDK> Once again you missed the point. I was referring to the "posting
JDK> faq" Tad autoposts. You know, where he whinges about how posting
JDK> to c.l.p.m require as much due diligence as an academic
JDK> journal. *guffaw* Put the bucket of hot chocolate down and do try
JDK> to pay attention.

and you need to learn the difference between an FAQ and posting
guidelines. try some taking reading comprehension classes.

uri
 
K

Keith Keller

and you need to learn the difference between an FAQ and posting
guidelines. try some taking reading comprehension classes.

'Jon Du Kim' appears to be another alias of the 'Ralph Malph' troll.

--keith
 
J

Jon Du Kim

I do not post any FAQ.
Call it whatever you want. How about being open to the idea that it is
useless in its current form and needs to be completely rewritten? Simply
put, it reflects a very dated 90's attitude.
usenet is a community of users, not a community of rules. whinging about
top posting is
ridiculous. The world has moved on...
 
U

Uri Guttman

KK> 'Jon Du Kim' appears to be another alias of the 'Ralph Malph' troll.

that explains the rectum occupied by the cranium syndrome.

uri
 
J

Justin C

Call it whatever you want.

If you'd called it by it's name instead of using a misleading
description then we'd not have wasted our time and the discussion may
have been useful. Instead it has descended to obscenities and name
calling. Well done.

<plonk>

Justin.
 
R

Rainer Weikusat

Jon Du Kim said:
Call it whatever you want. How about being open to the idea that it is
useless in its current form and needs to be completely rewritten?
Simply put, it reflects a very dated 90's attitude.
usenet is a community of users, not a community of rules. whinging
about top posting is ridiculous. The world has moved on...

JFTR: While your possibliy "very 90's dated entity" may not yet have
had any access to computers that long ago, I remember to have read
expressions of your really dated attitude, minus to 'so 1990s' tag,
obviously, in the 1990s.
[SCNR]
 
J

Jürgen Exner

Jon Du Kim said:
Call it whatever you want.

Johnston in The Last Emperor: Words are important.
Pu Yi, at 15: Why are words important?
Johnston: If you cannot say what you mean, your majesty, you will never
mean what you say and a gentleman should always mean what he says.

You may draw your own conlusions.

*PLONK*
How about being open to the idea that it is
useless in its current form and needs to be completely rewritten? Simply
put, it reflects a very dated 90's attitude.
usenet is a community of users, not a community of rules. whinging about
top posting is ridiculous. The world has moved on...

The world is welcome to use Twitter and Facebook

jue
 
J

John Bokma

Jürgen Exner said:
The world is welcome to use Twitter and Facebook

Oh, my, please stop this elitist behavior. Personally I think Stack
Overflow (in my case) has superseded Usenet for many of the instances I
used to use Usenet usually. And Facebook has superseded some other uses
I had for Usenet.

Each new thing has its place. Looking down on it all makes you an
elitist dinosaur ready to be fossilized.
 
J

Jürgen Exner

John Bokma said:
Oh, my, please stop this elitist behavior. Personally I think Stack
Overflow (in my case) has superseded Usenet for many of the instances I
used to use Usenet usually. And Facebook has superseded some other uses
I had for Usenet.

Each new thing has its place. Looking down on it all makes you an
elitist dinosaur ready to be fossilized.

And I don't have any problems with that.

I don't ask the world to like the cosy coffee shop around the corner.
But I do have a major problem with people busting in and demanding:
"This is a great place, but the world has moved on and you should change
this into a Hard Rock Cafe."
Don't you think I would be able to find a Hard Rock Cafe if I wanted to
visit one?

jue
 
J

John Bokma

Jürgen Exner said:
And I don't have any problems with that.

OK, maybe my bad, but I read it not like that.
I don't ask the world to like the cosy coffee shop around the corner.
But I do have a major problem with people busting in and demanding:
"This is a great place, but the world has moved on and you should change
this into a Hard Rock Cafe."

Why? They might have a point. I understand this is about the posting
guidelines (despite the OPs choice of wording in the subject). And maybe
the OP has a point: why keep posting those? Times have changed; back in
the 90's when I had access to Usenet it took me quite some time to post
my first message; I was somewhat anxious about this new thing, and first
took my time to learn the "rules".

This (in general) changed somewhere in the late 90's: people just barged
in on Usenet, and didn't care about guidelines. And endless pointless
discussions resulted in how to post, etc. And a majority of newbies (in
my experience) became pissed off with the (not only in their opinion)
elitist attitude causing some to become full time trolls for years.

Now it seems to get more quiet on Usenet, at least in most of the groups
I still follow. Newbies still barge in, but less often, and still don't
give a big F about posting guidelines. In a way it reminds me of the "No
tira basura" signs I see a lot here in Mexico: there is very often a
huge pile of garbage next to the sign.
Don't you think I would be able to find a Hard Rock Cafe if I wanted to
visit one?

I am not clairvoyant, so no idea. I have no idea where to find one where
I live, maybe there isn't one?

Anyway, just because it can't be posted, and has been posted for years
doesn't mean it has to be kept posted.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top