I have a set of functions which turn the contents of an e-mail message
object into a different object (called "article.")
article: make object! [
headline: subject-pieces/1
subheadline: subject-pieces/2
body: content-pieces
]
I'm trying to figure out how to probe the object and then write the
result of the probe out to a file for inclusion at a later date.
Here is a session...
>> breakdown-email msg
>> probe article
make object! [
headline: "headlineokay"
subheadline: "subheadlineokay"
body: ["by golly" "" "by gumby" ""]
]
>> write %bygolly.txt probe article
make object! [
headline: "headlineokay"
subheadline: "subheadlineokay"
body: ["by golly" "" "by gumby" ""]
]
REBOL - Security Check:
Script requests permission to open a port for read/write on: /boot/home
/bygolly.txt
Yes, allow all, no, or quit? (Y/A/N/Q) Y
>> uberall: read %bygolly.txt
== "?object?"
>> print uberall
?object?
>>
As you can see, the probe object only writes "?object?" to the %file.
What do I need to do to write the actual contents of the object?
The functions follow:
; -- BREAKDOWN-SUBJECT --
breakdown-subject: func [
"breakdown an e-mail subject field into its parts"
msg [object!] "e-mail message"
][
subject-info: msg/subject
subject-parts: []
foreach part parse/all subject-info ":" [
append subject-parts part
]
]
; -- BREAKDOWN-CONTENT --
breakdown-content: func [
"breakdown an e-mail content field into its parts"
msg [object!] "e-mail message"
][
article-info: msg/content
end-of-paragraph: rejoin [{.} newline]
content-parts: []
foreach part parse/all article-info end-of-paragraph [ append
content-parts part ]
]
; -- BREAKDOWN-EMAIL --
breakdown-email: func [
"breakdown an e-mail message object and convert it to an article
object"
msg [object!] "e-mail message"
][
subject-pieces: breakdown-subject msg
content-pieces: breakdown-content msg
article: make object! [
headline: subject-pieces/1
subheadline: subject-pieces/2
body: content-pieces
]
]