Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Format lines per page

by Flyghost (Novice)
on Nov 08, 2000 at 08:16 UTC ( [id://40472]=perlquestion: print w/replies, xml ) Need Help??

Flyghost has asked for the wisdom of the Perl Monks concerning the following question:

When using FORMAT_TOP and the output contains more then a certain amount of lines It adds a ^L (line break per page) in and printd the TOP header again. is there anyway we can go around that ? I want to output to be a long list without the ^L in it.

Replies are listed 'Best First'.
Re: Format lines per page
by extremely (Priest) on Nov 08, 2000 at 12:54 UTC
    The variable you are looking for is:
    $= = undef; # default is 60 lines per page. ## or use English; $FORMAT_LINES_PER_PAGE = undef; ## or format_lines_per_page HANDLE undef;

    --
    $you = new YOU;
    honk() if $you->love(perl)

      Hi, Can you please say where to use the $= = undef; ?
        Before you apply/print/output the formatting, see $=
Re: Format lines per page
by chromatic (Archbishop) on Nov 08, 2000 at 09:33 UTC
    The special variable $^L (or, in English, $FORMAT_FORMFEED) seems to have something to do with this. I can't find it in the Camel, but perlvar leads me to believe that's what you want.

    By default, it's \f (formfeed), but you might set it to a blank string or undefined and see what happens. (I haven't tried this, as formats are one of the things I've never used in Perl. The shame!)

    Update: It's on the middle of page 663 in Camel 3.

      Set that to undef and you'll get the header every 60 lines but no page feed. Bad bad bad. =) Set the page length, not the character it uses to flip pages.

      --
      $you = new YOU;
      honk() if $you->love(perl)

      FWIW, in Camel v2 it's page 133 (Formats starts on p121, it happens that I was looking at this stuff the other day). I rarely use formats but the more I read the more I think avoiding formats is a bit like avoiding modules ;-).
RE: Format lines per page
by Octavian (Monk) on Nov 08, 2000 at 18:36 UTC
    you can set the number of lines by setting $=, the default is 60 lines, if you wanted it to print a header after say 300 lines, you just just throw a
    $= = 300;
    before your write statement.
Re: Format lines per page
by Flyghost (Novice) on Nov 09, 2000 at 05:57 UTC
    Thanks for the tips. I got it to work with:
    use English; use FileHandle; format_lines_per_page HANDLE 300;
    If you use undef instead of 300 it will print the FORMAT_TOP after each line of output.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-25 16:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found