Subject: | MIME::Fast::DataWrapper lacks write_to_stream method |
GMime's GMimeDataWrapper objects have the ability to be written to a
GMime stream (at least in 2.2, can't find documentation for earlier
revisions):
http://developer.gnome.org/gmime/2.2/gmime-gmime-data-wrapper.html#g-mime-data-wrapper-write-to-stream
Without this functionality, it is pretty hard to save the actual
(unencoded) content of an attachment you get with MIME::Fast::Part
get_content_object (you can use get_content, but this creates a massive
Perl string if you have a multi-megabyte attachment, and defeats the
whole point of MIME::Fast, which is to bypass Perl when possible).
Adding support for this is pretty trivial - I was able to do this and I
have never touched an XS source file before.
Also, thanks to Alex Keusch for the patch to support GMime-2.2.22
https://rt.cpan.org/Public/Bug/Display.html?id=17654#txn-965344 (which
works fine for my RHEL5 GMime-2.2.26 as well)
Subject: | mime-fast-1.6-datawrapper-writetostream.patch |
diff -Nur MIME-Fast-1.6-orig/Fast/DataWrapper.xs MIME-Fast-1.6/Fast/DataWrapper.xs
--- MIME-Fast-1.6-orig/Fast/DataWrapper.xs 2003-06-16 05:22:36.000000000 -0400
+++ MIME-Fast-1.6/Fast/DataWrapper.xs 2011-10-18 03:48:49.000000000 -0400
@@ -42,4 +42,11 @@
g_mime_data_wrapper_get_encoding(mime_data_wrapper)
MIME::Fast::DataWrapper mime_data_wrapper
-
+ssize_t
+g_mime_data_wrapper_write_to_stream(mime_data_wrapper, mime_stream)
+ MIME::Fast::DataWrapper mime_data_wrapper
+ MIME::Fast::Stream mime_stream
+ CODE:
+ RETVAL = g_mime_data_wrapper_write_to_stream (mime_data_wrapper, mime_stream);
+ OUTPUT:
+ RETVAL