On Tue, Aug 4, 2009 at 16:35, Bryan Harris<br...@harrisfam.net> wrote: snip >> while ( defined (my $answer = $term->readline("Enter a date and >> note:", "8/2 Updated database")) ) { >> print "you said $answer\n"; >> } > > > Thanks for the response Chas -- oddly it doesn't work. This is what it > prints: > > 2054% ./test > Enter a date and note:Uh. > you said Uh. snip
I assume you changed the second string to "Uh.". If so, then that is what is supposed to happen. $term->readline() prompts with the first string with a default of the second. When you hit enter, the input is stored in $answer. All my loop does with the answer is tell you what you said. snip > I don't understand the documentation -- I don't know what a "package", > "stub", or "method" are in this context, and I've been perl coding for > nearly 10 years! Obviously experience doesn't always equate to expertise. snip Package refers to the multiple readline backends which are implemented as modules (Term::Readline::GNU, Term::Readline::Perl, etc.). Some of these backends have more features than others, but you always have access to a base level of functionality in Term::Readline::Perl. Stubs are short functions that don't do anything. They are needed in case the backend does not provide a feature. The stub will be called instead and do nothing. This will prevent the program from blowing up, allowing it to run with reduced functionality. For instance, a backend might not provide a history of previous entries. In that case, addhistory won't do anything, but calling it won't cause a runtime error. A method is a subroutine called on an object: $obj->method(); -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/