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

Discussion in 'Perl Misc' started by PerlFAQ Server, Apr 11, 2011.

  1. 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.
     
    PerlFAQ Server, Apr 11, 2011
    #1
    1. Advertising

  2. Re: FAQ flood MUST end

    PerlFAQ Server <> 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 : :
    Call me bored, but don't call me boring.
    -- Larry Wall in <>
     
    Andrzej Adam Filip, Apr 11, 2011
    #2
    1. Advertising

  3. PerlFAQ Server

    Keith Keller Guest

    Re: FAQ flood MUST end

    On 2011-04-11, Andrzej Adam Filip <> wrote:
    > PerlFAQ Server <> 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


    --
    -francisco.ca.us
    (try just my userid to email me)
    AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
    see X- headers for PGP signature information
     
    Keith Keller, Apr 11, 2011
    #3
  4. PerlFAQ Server

    brian d foy Guest

    Re: FAQ flood MUST end

    In article <>, Andrzej Adam Filip
    <> wrote:

    > PerlFAQ Server <> 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.
     
    brian d foy, Apr 11, 2011
    #4
  5. PerlFAQ Server

    ccc31807 Guest

    Re: FAQ flood MUST end

    On Apr 11, 1:31 pm, Andrzej Adam Filip <> 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.
     
    ccc31807, Apr 11, 2011
    #5
  6. PerlFAQ Server

    Justin C Guest

    Re: FAQ flood MUST end

    On 2011-04-27, Shmuel Metz <> wrote:
    > In
    > <>,
    > on 04/11/2011
    > at 12:16 PM, ccc31807 <> 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.
     
    Justin C, Apr 27, 2011
    #6
  7. Re: FAQ flood MUST end

    >>>>> "Justin" == Justin C <> 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
    <> <URL:http://www.stonehenge.com/merlyn/>
    Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
    See http://methodsandmessages.posterous.com/ for Smalltalk discussion
     
    Randal L. Schwartz, Apr 27, 2011
    #7
  8. PerlFAQ Server

    Jon Du Kim Guest

    Re: FAQ flood MUST end

    > 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?
     
    Jon Du Kim, Apr 27, 2011
    #8
  9. PerlFAQ Server

    Uri Guttman Guest

    Re: FAQ flood MUST end

    >>>>> "JDK" == Jon Du Kim <> 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 ------ -------- http://www.sysarch.com --
    ----- Perl Code Review , Architecture, Development, Training, Support ------
    --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
     
    Uri Guttman, Apr 27, 2011
    #9
  10. PerlFAQ Server

    Jon Du Kim Guest

    Re: FAQ flood MUST end

    > 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.
     
    Jon Du Kim, Apr 27, 2011
    #10
  11. PerlFAQ Server

    Uri Guttman Guest

    Re: FAQ flood MUST end

    >>>>> "JDK" == Jon Du Kim <> writes:

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


    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

    --
    Uri Guttman ------ -------- http://www.sysarch.com --
    ----- Perl Code Review , Architecture, Development, Training, Support ------
    --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
     
    Uri Guttman, Apr 27, 2011
    #11
  12. PerlFAQ Server

    Keith Keller Guest

    Re: FAQ flood MUST end

    On 2011-04-27, Uri Guttman <> wrote:
    >>>>>> "JDK" == Jon Du Kim <> writes:

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

    --
    -francisco.ca.us
    (try just my userid to email me)
    AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
    see X- headers for PGP signature information
     
    Keith Keller, Apr 27, 2011
    #12
  13. PerlFAQ Server

    Jon Du Kim Guest

    Re: FAQ flood MUST end

    On 4/27/2011 5:56 PM, Tad McClellan wrote:
    > Jon Du Kim<> wrote:
    >>> 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

    >
    >
    > 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...
     
    Jon Du Kim, Apr 27, 2011
    #13
  14. PerlFAQ Server

    Uri Guttman Guest

    Re: FAQ flood MUST end

    >>>>> "KK" == Keith Keller <-francisco.ca.us> writes:

    KK> On 2011-04-27, Uri Guttman <> wrote:
    >>>>>>> "JDK" == Jon Du Kim <> writes:

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


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

    that explains the rectum occupied by the cranium syndrome.

    uri

    --
    Uri Guttman ------ -------- http://www.sysarch.com --
    ----- Perl Code Review , Architecture, Development, Training, Support ------
    --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
     
    Uri Guttman, Apr 27, 2011
    #14
  15. PerlFAQ Server

    Justin C Guest

    Re: FAQ flood MUST end

    On 2011-04-27, Jon Du Kim <> wrote:
    > On 4/27/2011 5:56 PM, Tad McClellan wrote:
    >> Jon Du Kim<> wrote:
    >>>> 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

    >>
    >>
    >> I do not post any FAQ.

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

    --
    Justin C, by the sea.
     
    Justin C, Apr 28, 2011
    #15
  16. Re: FAQ flood MUST end

    Jon Du Kim <> writes:
    > On 4/27/2011 5:56 PM, Tad McClellan wrote:
    >> Jon Du Kim<> wrote:
    >>>> 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

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


    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]
     
    Rainer Weikusat, Apr 28, 2011
    #16
  17. Re: FAQ flood MUST end

    Jon Du Kim <> wrote:
    >On 4/27/2011 5:56 PM, Tad McClellan wrote:
    >> Jon Du Kim<> wrote:
    >>>> 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

    >>
    >>
    >> I do not post any FAQ.

    >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ürgen Exner, Apr 28, 2011
    #17
  18. PerlFAQ Server

    John Bokma Guest

    Re: FAQ flood MUST end

    Jürgen Exner <> writes:

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

    --
    John Bokma j3b

    Blog: http://johnbokma.com/ Facebook: http://www.facebook.com/j.j.j.bokma
    Freelance Perl & Python Development: http://castleamber.com/
     
    John Bokma, Apr 28, 2011
    #18
  19. Re: FAQ flood MUST end

    John Bokma <> wrote:
    >Jürgen Exner <> writes:
    >
    >> 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.


    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ürgen Exner, Apr 28, 2011
    #19
  20. PerlFAQ Server

    John Bokma Guest

    Re: FAQ flood MUST end

    Jürgen Exner <> writes:

    > John Bokma <> wrote:
    >>Jürgen Exner <> writes:
    >>
    >>> 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.

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

    --
    John Bokma j3b

    Blog: http://johnbokma.com/ Facebook: http://www.facebook.com/j.j.j.bokma
    Freelance Perl & Python Development: http://castleamber.com/
     
    John Bokma, Apr 28, 2011
    #20
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bengt Richter
    Replies:
    13
    Views:
    8,143
    Piet van Oostrum
    Sep 10, 2003
  2. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,260
    Smokey Grindel
    Dec 2, 2006
  3. Robert Wallace

    my own perl "dos->unix"/"unix->dos"

    Robert Wallace, Jan 21, 2004, in forum: Perl Misc
    Replies:
    7
    Views:
    316
    Michele Dondi
    Jan 22, 2004
  4. Replies:
    5
    Views:
    115
  5. PerlFAQ Server
    Replies:
    0
    Views:
    282
    PerlFAQ Server
    Apr 26, 2011
Loading...

Share This Page