Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Paging on input/file

by trantor (Chaplain)
on Aug 04, 2004 at 08:20 UTC ( #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: | 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?

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2023-11-29 12:35 GMT
Find Nodes?
    Voting Booth?

    No recent polls found