[REBOL] Re: parse-header
From: brett:codeconscious at: 1-May-2001 8:00
Hi Ryan,
The parent parameter of parse-header seems to provide a template of the
object you want returned. Using none gives
you an object where you only get fields for the header lines actually in
your string and one content field.
The use of parse-header in mime-model.r is
parse-header none message
because I want an object where only the header lines present in string
become fields in the returned object.
Here's an example of it in action:
>> probe parse-header none {any-old-header: some value
{
{ The content}
make object! [
any-old-header: "some value"
content: "The content"
]
Alternatively if I had a template I could do:
>> template-object: context [header1: header2: none]
>> probe parse-header template-object {header1: value1
{
{ My content - notice no header line for header2}
make object! [
header1: "value1"
header2: none
content: "My content - notice no header line for header2"
]
I came across the function when I was trying to understand how the
import-email function worked.
source import-email
Regards
Brett.