Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
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

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?
[marioroy]: We made it all the way to the end. The expience was magical. I not good at sports. Someone or thing was there.
erix considers extracting a catalog ...
[karlgoethebier]: marioroy: Racket ball is considered harmful, like Squash
[marioroy]: Wait till folks see what MCE::Hobo can do in the upcoming release. Multiple instances, nested spawning, 3 levels, doesn't matter. it works on Windiows too.
[Lady_Aleena]: I hate sites that tell me to turn ad-blocker off. They should know better.
[marioroy]: s/Windiows/ Windows/
[Discipulus]: marioroy can you expand that Niagara's fall history?
erix only sees fallen angels
erix if it weren't for bad luck, I'd have no luck at all
Discipulus Windiows the OS of native americans..

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (12)
As of 2017-05-29 08:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?