Hi,
I could use open(STDOUT,"| more") option to more big file.
After this, I close STDOUT as if, I do not close, readline prints the prompt even when 
more is not 100%.
#######################################
open(STDOUT,"| more") || "Cannot open stdout for more $!";
$status = system("cat report.txt");
$status = system("clear");
close STDOUT;
## If I do not close handler then I get the prompt(see below) on
 ## the very first page of the screen. I need to ask this once 
# more is done with 100% display of file. Actually, before #deletion I want to show 
the #data to user and then ask about his #consent for deletion.
 
$term = new Term::ReadLine '999';
$prompt = "All the rows displayed above will be removed\nDo you want to continue?(Y/N) 
:";
$option = $term->readline($prompt);
######################################

Now if i try to print the option. I do not get anything even if user says 'y'. Looks 
like if i close STDOUT, readline does not read.
Any pointers will be appreciated.

Thanks,
Raminder


Bob Showalter <[EMAIL PROTECTED]> wrote:
[EMAIL PROTECTED] wrote:
> Hi There,
> Any pointers to how to call "more" on a file in perl script.
> I am writing one script which displays one report to user and then
> asks some inputs.
> 
> User need to see complete file. To solve this, I thought I can call
> `more in the script and continue.
> But looks loke it is not possible.

You didn't post your script, so I can only guess.

You can't use backticks, since they capture the output. If more is writing
to a non-tty (because you're capturing the output), it obviously has no way
to pause at a screenful, so it just passes the entire input to the output.

You need to use system() instead.

Also, it's customary to respect $ENV{PAGER}. I have my pager set to less,
for example.

Read "perldoc perlopentut" and search for PAGER to see an example of how to
do this kind of thing.
                
---------------------------------
Do you Yahoo!?
Friends.  Fun. Try the all-new Yahoo! Messenger

Reply via email to