Re: Maximum length input line
[email protected] (Peter Scott) Sun, 20 Aug 2000 09:34:50 -0700
| Newsgroups | perl.perl6.language.io |
|---|---|
| Message-ID | <[email protected]> |
At 10:06 AM 8/20/00 -0400, Bryan C. Warnock wrote: >On Sun, 20 Aug 2000, Peter Scott wrote: > > > I read that before I made my posting; it looked to me that :block was > > specifying a fixed-length read independent of line terminators, i.e., same > > behavior as $/ = \1024. > >Stand-alone, I guess it would be. But I would think that combining it >with, say, :text=unix, should give you the behavior you'd want. >(Assuming, of course, that this is the way it's going to work.) Well you guys are way ahead of me on your line discipline modes, so I didn't want to hazard a syntax; just wanted to make my desires known. > > >(And I'll add, I don't think the rest of the line should be thrown > > >away.) > > > > No harm in making the choice another mode switch, no? > >As in reading the first n columns? > >:col=1024 > >Read the first 1024 columns of each line, and if the line happens to >be shorter than 1024, so be it? That's what I was looking for, but the other choice I was talking about was whether the excess is thrown away or comes in on the next read. So there are these 3 scenarios when a line longer than the user's desired maximum arrives: # No options changed, i.e., current behavior $line = <FOO>; # $line gets whatever the input was # Maximum input length set to $MAXLEN # Excess is thrown away $line = <FOO>; # $length($line) == $MAXLEN $line = <FOO>; # $line is filled from after last line terminator # Maximum input length set to $MAXLEN # Excess left in input buffer $line = <FOO>; # $length($line) == $MAXLEN $line = <FOO>; # $line filled starting from next character after previous $line -- Peter Scott Pacific Systems Design Technologies