[Chicago-talk] Slurp

Chris McAvoy mcavoy76 at hotmail.com
Tue Dec 23 14:39:21 CST 2003


So, I have to work today, which sucks.  So I decided to play around a little
bit.  I found a cool module called Mail::Simple, and I want to use it to
make a fun little "MailBot" for a few mailing lists I'm responsible for.
The mailing lists are handled by Mailman.  I want to pop a script in front
of Mailman that intercepts the incoming emails, checks for "certain stuff",
and responds with "other stuff", or passes the email on to Mailman for
suitable Pythonizing.

I slurp STDIN, parse what I can only hope is an email message with
Mail::Simple, and do something fun and cool, or just write the message
(unmolested) back out to STDOUT.

My concern is, what if some joker sends me an email with a huge attachment?
Because I'm slurping STDIN, they could really whack me right?

I found this article: http://www.perl.com/pub/a/2003/11/21/slurp.html?page=2
on file slurping.  The last paragraph says, "You must still be aware to not
slurp humongous files (logs, DNA sequences, and so forth), or STDIN, where
you don't know how much data you will read in."

So, there you have it, some guy is telling me to not slurp STDIN.  What
should I do here?  Any ideas?  Hopefully everyone will be writing me back
via wireless in front of the fireplace with a dog or something keeping their
feet warm, instead of from a cold gray cubicle.

Chris



More information about the Chicago-talk mailing list