Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Supressing page breaks in forms

by Albannach (Prior)
on May 29, 2009 at 01:56 UTC ( #766789=note: print w/ replies, xml ) Need Help??


in reply to Supressing page breaks in format/write output

Have you tried setting $- (number of lines left on the current page) to a suitably large number after each write instead?

Update Since there seems to be some question as to whether my suggestion would work, I did the following test:

use strict; use warnings; $= = 5; for(1..15) { write; #$- = 999; } format STDOUT = @### @###### @### $_, $_**2, $- . format STDOUT_TOP = ---TOP--- . __END__
If I run the above, I get the following at the console:
---TOP--- 1 1 0 2 4 3 3 9 2 4 16 1 ♀---TOP--- 5 25 0 6 36 3 7 49 2 8 64 1 ♀---TOP--- 9 81 0 10 100 3 11 121 2 12 144 1 ♀---TOP--- 13 169 0 14 196 3 15 225 2
and if I uncomment the line setting $- to 999, I get:
---TOP--- 1 1 0 2 4 999 3 9 999 4 16 999 5 25 999 6 36 999 7 49 999 8 64 999 9 81 999 10 100 999 11 121 999 12 144 999 13 169 999 14 196 999 15 225 999
So I believe resetting $- should work. It is also noted in perlfunc under write that setting $- to zero will force a page break, which follows the same pattern.

--
I'd like to be able to assign to an luser


Comment on Re: Supressing page breaks in forms
Select or Download Code
Replies are listed 'Best First'.
Re^2: Supressing page breaks in forms
by yaconsult (Acolyte) on Jun 01, 2009 at 22:18 UTC
    The excerpt below is doing the write. The array has about 260 elements. At line 60, a control-L and header repeat are printed, so clearly, I'm not setting the number of lines remaining the way I want to. To avoid confusion about special variables, I'm using the English module to be clear about what I'm setting.
    foreach my $line (@top_users_results) { ( $day, $hour, $count, $uid ) = split( ",", $line ); $hour = substr( $hour, 0, 5 ); $hits_total += $count; write TOPUSERS_COUNTS; $FORMAT_LINES_LEFT = 999; }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (11)
As of 2015-07-31 20:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (281 votes), past polls