On Mar 30, 2009, at 6:31 AM, Rodrick Brown wrote:


Sounds like something as basic as

print "Question to ask: ";
$value=<INPUT>;

is what your looking for?

No, I'm looking for a limited version of the editing capabilities that modern command line interfaces have; namely, the ability to "preload" the input area and to allow the user to edit it.

# Re-constitute the natural form of city/state/zip
# from the "terse" form that we already have.

my $default_input = foo("IN-NewDurhamTwpMetro66765");

# Now $default_input contains "New Durham Twp Metro, IN 66765"
# Call my get_input routine, which pre-loads the input area
# with the text in $default_input and permits the user to
# edit the default text, exactly the way modern shells allow
# you to edit the command line.

print "Enter city, state, and zip: ";
my $input = get_input( $default_input );

---
Enter city, state, and zip: _ew Durham Twp Metro, IN 66765
---

The underscore indicates where the cursor appears: under 'N', the first character of the input field. At this point the user can edit (e.g. forward-cursor to 'Twp' and change it to 'Township').

[In the above example, I'm looking for the implementation of get_input(), *not* of foo()!]

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to