[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 1.4 build problems (sorry!)
From: |
Alex Shinn |
Subject: |
Re: 1.4 build problems (sorry!) |
Date: |
23 Feb 2002 10:06:20 +0900 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/21.1 |
>>>>> "Jeff" == Jeff Read <address@hidden> writes:
Jeff> On Fri, Feb 22, 2002 at 11:01:33AM -0800, Thien-Thi Nguyen
Jeff> wrote:
>>
>> i've appended the perl script below so we can collaboratively
>> rework the beast. it looks like the heart is the "$/ = foo"
>> lines. what does that mean in perl?
Jeff> $/ is, I believe, the current end-of-line terminator; default
Jeff> is "\n". That's right, they're parsing the file by tricking
Jeff> the <FOO> operator (Perl's equivalent to (read-line)) into
Jeff> grabbing everything up to the tag, by telling Perl that the
Jeff> tag is newline!
Well, they call it the end-of-record separator, since you're allowed to
make records not depend on newlines.
The Scheme literal equivalent to this script would be reading lines from
the file into a buffer until you find the string you're looking for.
Like read-delimited but looking for full strings. But this technique in
general is very fragile - even Perl hackers will tell you you don't want
to use regexps to parse HTML. You're better off with an existing
template system (autogen works with Guile), or if you're going to write
your own at least use a proper parser (try SXML).
--
Alex