Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Perl replacement for choice.com

by onelander (Sexton)
on Mar 04, 2013 at 18:19 UTC ( #1021689=note: print w/ replies, xml ) Need Help??


in reply to Re: Perl replacement for choice.com
in thread Perl replacement for choice.com

I believe I know one area you were talking about but I am not certain of the second. Removing all the comments, is this what you mean?

if ( defined $default ) { my $stderr; close STDERR; open(STDERR, ">", \$stderr); my $grabkey_thread = threads->create(\&grabkey); $grabkey_thread->detach(); for ( my $i = 0; $i <= $timeout; $i++ ) { sleep 1; } my $pos = index( uc( $choices ), uc( $default ) ) + 1; print uc( $default ) . "\n"; exit $pos; } else { grabkey(); } => if ( defined $default ) { my $stderr; close STDERR; open(STDERR, ">", \$stderr); my $grabkey_thread = threads->create(\&grabkey); $grabkey_thread->detach(); for ( my $i = 0; $i <= $timeout; $i++ ) { sleep 1; } my $pos = index( uc( $choices ), uc( $default ) ) + 1; print uc( $default ) . "\n"; exit $pos; } grabkey();


Comment on Re^2: Perl replacement for choice.com
Download Code
Re^3: Perl replacement for choice.com
by Tux (Monsignor) on Mar 04, 2013 at 22:10 UTC

    yes, you caught both

    It is a bit of a shame you edited the original posted code, as now "new" readers will not see the changes you made based on the comments you got, and the comments now make no sense at all (for those people).

    As you learn from perlmonks, readers that stumble on this post no wdo not learn from the code changes. (FWIW By learning from changes I do not imply that all changes are always correct, but discussion about them makes you take desicions that are more thought-through.


    Enjoy, Have FUN! H.Merijn
      What is the best way to handle updates to the code? I assume leave the original code as is and then in the comments show the updates. Where is the best place to put the fully corrected version of the code?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1021689]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (18)
As of 2014-07-23 13:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (144 votes), past polls