long records, page breaks in formats 
Author Message
 long records, page breaks in formats

I understand that if there is no room for the next record
(produced by write) on the current page, as determined by $=
and $-, then the format in $^ eg STDOUT_TOP should be used,
preceded by the formfeed selected in $^L..
OK, that works, but what is SUPPOSED to happen if the record
produced by write, eg from
~~^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$string
is longer than $= lines?  On my system:
Perl 4.036, Sparc, solaris 1.1, and 2.3
it just produces an enormous record with no page breaks in it.
What should happen does not seem to be defined in "Programming Perl",
or in the manual, and the text in both looks very similar. :-)
Is there a way to get page breaks where I expect?  Should I
resort to doing the pagebreak calculations by hand?
Maybe I am doing the select stuff wrong as in my earlier message.
I am selecting formats generated from an eval, and doing
select($k);
$~ = $k;
$^ = $k . "_TOP";
$= = 60;        #just for good measure
write;

        Thank you again.
        Hugh



Fri, 09 May 1997 23:33:07 GMT  
 long records, page breaks in formats
: I understand that if there is no room for the next record
: (produced by write) on the current page, as determined by $=
: and $-, then the format in $^ eg STDOUT_TOP should be used,
: preceded by the formfeed selected in $^L..
: OK, that works, but what is SUPPOSED to happen if the record
: produced by write, eg from
: ~~^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
: $string
: is longer than $= lines?  On my system:
: Perl 4.036, Sparc, solaris 1.1, and 2.3
: it just produces an enormous record with no page breaks in it.
: What should happen does not seem to be defined in "Programming Perl",
: or in the manual, and the text in both looks very similar. :-)
: Is there a way to get page breaks where I expect?  Should I
: resort to doing the pagebreak calculations by hand?
: Maybe I am doing the select stuff wrong as in my earlier message.
: I am selecting formats generated from an eval, and doing
: select($k);
: $~ = $k;
: $^ = $k . "_TOP";
: $= = 60;      #just for good measure
: write;

I won't claim it's right, but that's how it's always worked.  You can
always handle each line yourself.  Take out the ~~ and then do

        write while $string ne "";

Larry



Sat, 17 May 1997 08:49:26 GMT  
 long records, page breaks in formats

Quote:
Larry Wall writes:
>I won't claim it's right, but that's how it's always worked.  You can
>always handle each line yourself.  Take out the ~~ and then do

>    write while $string ne "";

>Larry

Along these lines I would like to include a blank line in my "write" output. I
thought that the above would do it for me, but alas no.

I have a variable with long text and occasionally a double newline (\n\n).
Seems format in VMS perl 5.000 takes this as one newline and nukes the other.
Tried format def'n with ~~and without (using technique above). As well, tried
setting  $: = " ".  Tried to watch for substr($text,0,1) eq"\n" and then
"printing" a blank line.

Is there something that I might be missing - any techniques here?

Thanks,

Jay



Sun, 18 May 1997 02:01:12 GMT  
 long records, page breaks in formats

: : I understand that if there is no room for the next record
: : (produced by write) on the current page, as determined by $=
: : and $-, then the format in $^ eg STDOUT_TOP should be used,
: : preceded by the formfeed selected in $^L..
: : OK, that works, but what is SUPPOSED to happen if the record
: : produced by write, eg from
: : ~~^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
: : $string
: : is longer than $= lines?  On my system:
: : Perl 4.036, Sparc, solaris 1.1, and 2.3
: : it just produces an enormous record with no page breaks in it.
: : What should happen does not seem to be defined in "Programming Perl",
: : or in the manual, and the text in both looks very similar. :-)
: : Is there a way to get page breaks where I expect?  Should I
: : resort to doing the pagebreak calculations by hand?
: : Maybe I am doing the select stuff wrong as in my earlier message.
: : I am selecting formats generated from an eval, and doing
: : select($k);
: : $~ = $k;
: : $^ = $k . "_TOP";
: : $= = 60;    #just for good measure
: : write;

: I won't claim it's right, but that's how it's always worked.  You can
: always handle each line yourself.  Take out the ~~ and then do

:       write while $string ne "";

: Larry

        Yes, I actually calculated how much of the string to pass
        to make it fill the page, and I passed only that much and
        I was thus able to leave the ~~ in the format.  So
        I have it working how I want now.  Could I put in a plea
        for an option to allow page breaks on reaching $= lines, so
        that long records *could* be split?  I haven't looked at the
        code to see how hard that is.  Also, could I suggest another
        option, one that could allow the honouring of newlines in
        folded strings like the above, so that if paragraphs are
        formatted into a narrower column than the original text they
        can be reflected in the narrow column? What I do now is to
        pad out all the lines with whitespace. What I mean is that
        if I want to reformat a description as in "flealist" (p264,
        Camel book) which has more than one paragraph, the paragraphing
        could be maintained by only preserving the final \n in each
        paragraph. Then if newlines were honoured the next paragraph
        would start on a new line.  I could not find a way to preserve
        such structure when I tried to do that with formats earlier.
        Obviously the way this works now is not incorrect and there
        would be lots of times when I want that sort of reformatting
        of newlines as whitespace, but that extra control would be nice.

        Thank you,
        Hugh



Fri, 23 May 1997 22:19:24 GMT  
 long records, page breaks in formats

Quote:
: Larry Wall writes:

:
: >I won't claim it's right, but that's how it's always worked.  You can
: >always handle each line yourself.  Take out the ~~ and then do
: >
: >  write while $string ne "";
: >
: >Larry
:
: Along these lines I would like to include a blank line in my "write" output. I
: thought that the above would do it for me, but alas no.
:
: I have a variable with long text and occasionally a double newline (\n\n).
: Seems format in VMS perl 5.000 takes this as one newline and nukes the other.
: Tried format def'n with ~~and without (using technique above). As well, tried
: setting  $: = " ".  Tried to watch for substr($text,0,1) eq"\n" and then
: "printing" a blank line.
:
: Is there something that I might be missing - any techniques here?


Second, I seem to recall making it so that \r would force a line break
within ^ fields.

Larry



Mon, 26 May 1997 02:43:48 GMT  
 long records, page breaks in formats
:       Also, could I suggest another
:       option, one that could allow the honouring of newlines in
:       folded strings like the above, so that if paragraphs are
:       formatted into a narrower column than the original text they
:       can be reflected in the narrow column? What I do now is to
:       pad out all the lines with whitespace. What I mean is that
:       if I want to reformat a description as in "flealist" (p264,
:       Camel book) which has more than one paragraph, the paragraphing
:       could be maintained by only preserving the final \n in each
:       paragraph. Then if newlines were honoured the next paragraph
:       would start on a new line.  I could not find a way to preserve
:       such structure when I tried to do that with formats earlier.
:       Obviously the way this works now is not incorrect and there
:       would be lots of times when I want that sort of reformatting
:       of newlines as whitespace, but that extra control would be nice.

Pass an embedded \r, and I believe Perl 5 will do a line-break at that
point.

Larry



Tue, 03 Jun 1997 06:30:38 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. mySQL - More records or longer records - Speed?

2. Report page-break and page-count

3. **FORMAT Formatting columns/pages

4. mysql INSERT is broken by some charactors in the inserted record

5. How does one break a long string?

6. How can you break up long regular expressions?

7. How to insert newline break into a long string

8. Broken CPAN Module. IO modules no longer compile

9. Breaking a long word

10. Help breaking up long HTML lines

11. breaking long lines

12. How does one break a long string?

 

 
Powered by phpBB® Forum Software