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.

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 01, 2001 5:24 AM
Subject: [REBOL] parse-header


> Can anyone point me to usage documentation for 'parse-header? Using 'help,
> I get the following, but I'm still not sure what 'parse-header is used
for?
> (I'm trying to digest mime-model.r and it uses 'parse-header)
>
>
> >> help parse-header
> USAGE:
>     PARSE-HEADER parent data
>
> DESCRIPTION:
>      Returns a header object with header fields and their values
>      PARSE-HEADER is a function value.
>
> ARGUMENTS:
>      parent -- Default header object (Type: object none)
>      data -- String to parse (Type: any-string)
>
>
> Thanks.
>
> Ryan C. Christiansen
> Web Developer
>
> Intellisol International
> 4733 Amber Valley Parkway
> Fargo, ND 58104
> 701-235-3390 ext. 6671
> FAX: 701-235-9940
> http://www.intellisol.com
>
> Global Leader in People Performance Software
>
> _____________________________________
>
> Confidentiality Notice
> This message may contain privileged and confidential information. If you
> think, for any reason, that this message may have been addressed to you in
> error, you must not disseminate, copy or take any action in reliance on
it,
> and we would ask you to notify us immediately by return email to
> [EMAIL PROTECTED]
>
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.
>

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to