Gossamer Forum
Home : Products : DBMan SQL : Development, Plugins and Globals :

GT:Mail->parse a scalar in memory, not a temp file

Quote Reply
GT:Mail->parse a scalar in memory, not a temp file
(Off-topic for DbSql per se, but that's how I got GT:Mail.)

I'm trying to use GT::Mail->parse() to read a message (including header) from a scalar, without writing it to a temporary file first. (I built the scalar with GT::Template->parse(), so I could interpolate variables in the header as well as the body, and so the template could contain arbitrary headers. A nice strategy, so far.)

IO::String didn't work; neither did the perl 5.8 open(..., reference). In the latter case, I see it tries to "read $value" with the LENGTH argument of "-s $value" -- i.e. it just slurps the entire file into a scalar anyway -- but perl 5.8.2 returns 'undef' for -s here, resulting in it reading nothing. It's not quite a real file, when viewed from this angle.

Now what? Is there, for instance, some other entry point in GT::Mail that will do what I want? I will write a temporary file if I must, but I'm trying my best to avoid it.