Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

hrmm... your script fails horribly for me. It freezes after I type the first character. The 'Type fast:' prompt is also right-flushed on my terminal. Uncommenting your cygwin line fixes the right-flushed text, but that is a bad way to do it. $/ is best kept at "\n". Try using \015\012 instead of \r\n as well. "\r\n" and "\015\012" are not guaranteed to be the same value. So to beat the snot out of POE for once (and most likely only time) in my life heh:

#!/usr/bin/perl -w $|++; use strict; my ($input, $failed); STARTIT: eval { local $SIG{ALRM} = sub { die "timed out\n" }; print 'You have 10 seconds. Type fast: '; alarm 10; chomp( $input = <STDIN> ); alarm 0; }; if ($@) { if ($@ eq "timed out\n") { if (++$failed == 3) { print "\nTimed out 3 times. You're toast!\n\n" and exit; } else { print "\nTimed out. Try again!\n\n"; } } else { die "Unhandled error: $@"; } } else { print "You said '$input'. 10 more seconds now!\n\n"; } goto STARTIT;


If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, please reply to this node or /msg me to inform me as to what is wrong with the post, so that I may update the node to the best of my ability.


In reply to Re: An introduction to POE by Coruscate
in thread An introduction to POE by RMGir

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-04-19 04:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found