Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Paging on input/file

by trantor (Chaplain)
on Aug 04, 2004 at 08:20 UTC ( [id://379934]=note: print w/replies, xml ) Need Help??


in reply to Paging on input/file

If your program is not interactive, just follow the *NIX tradition, i.e. just print your output and let the user decide to page it if necessary, like:

yourscript.pl | less

If your program is interactive (i.e. it waits for input from the user) then this is not feasible. You can either write your own little pager using for example Curses, or you can yet again follow a well established *NIX convention and run the user's favourite pager, which is usually stored in $ENV{PAGER}.

Using the user's pager has the definite advantages of not having to reinvent the wheel (think lazy (-;) and presenting the user with a well-known interface for viewing long files.

If you use system, it is a good idea to pass a list and not a single scalar as an argument: the single scalar could be interpreted by the shell (for example if it has wildcards) with possibly nasty or anyway unwanted side effects.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-04-18 08:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found