Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

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

 
 
PerlFAQ Server
Guest
Posts: n/a
 
      04-11-2011
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.
 
Reply With Quote
 
 
 
 
Andrzej Adam Filip
Guest
Posts: n/a
 
      04-11-2011
PerlFAQ Server <(E-Mail Removed)> wrote:
> 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?

--
[pl>en Andrew] Andrzej A. Filip : http://www.velocityreviews.com/forums/(E-Mail Removed) : (E-Mail Removed)
Call me bored, but don't call me boring.
-- Larry Wall in <(E-Mail Removed)>
 
Reply With Quote
 
 
 
 
Keith Keller
Guest
Posts: n/a
 
      04-11-2011
On 2011-04-11, Andrzej Adam Filip <(E-Mail Removed)> wrote:
> PerlFAQ Server <(E-Mail Removed)> wrote:
>> 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


--
http://www.velocityreviews.com/forums/(E-Mail Removed)-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information

 
Reply With Quote
 
brian d foy
Guest
Posts: n/a
 
      04-11-2011
In article <(E-Mail Removed)>, Andrzej Adam Filip
<(E-Mail Removed)> wrote:

> PerlFAQ Server <(E-Mail Removed)> wrote:
> > 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.
 
Reply With Quote
 
ccc31807
Guest
Posts: n/a
 
      04-11-2011
On Apr 11, 1:31*pm, Andrzej Adam Filip <(E-Mail Removed)> wrote:
> 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.
 
Reply With Quote
 
Justin C
Guest
Posts: n/a
 
      04-27-2011
On 2011-04-27, Shmuel Metz <(E-Mail Removed)> wrote:
> In
> <(E-Mail Removed)>,
> on 04/11/2011
> at 12:16 PM, ccc31807 <(E-Mail Removed)> said:
>
>>The FAQ posts are, for me, a valuable resource for keeping up-to-date
>>with Perl.

>
> 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.

--
Justin C, by the sea.
 
Reply With Quote
 
Randal L. Schwartz
Guest
Posts: n/a
 
      04-27-2011
>>>>> "Justin" == Justin C <(E-Mail Removed)> writes:

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.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<(E-Mail Removed)> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion
 
Reply With Quote
 
Jon Du Kim
Guest
Posts: n/a
 
      04-27-2011
> 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?
 
Reply With Quote
 
Uri Guttman
Guest
Posts: n/a
 
      04-27-2011
>>>>> "JDK" == Jon Du Kim <(E-Mail Removed)> writes:

>> I would hope that FAQ answers get reviewed/updated more frequently
>> than every 25 years!


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

--
Uri Guttman ------ (E-Mail Removed) -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
 
Reply With Quote
 
Jon Du Kim
Guest
Posts: n/a
 
      04-27-2011
> 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows binary stdin goes EOF after \x1a character Dan Python 2 10-15-2010 07:53 PM
ifstream eof not reporting eof? SpreadTooThin C++ 10 06-15-2007 08:49 AM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
if EOF = -1, can't a valid character == EOF and cause problems? Kobu C Programming 10 03-04-2005 10:40 PM
Reading stdin once confuses second stdin read Charlie Zender C Programming 6 06-21-2004 01:39 PM



Advertisments