Catalyst::Controller::MIME - Multipart MIME viewer via Catalyst
package MyApp::Controller::MimeView; use Moose; use namespace::autoclean; use Email::MIME; BEGIN {extends 'Catalyst::Controller::MIME'; } sub get_mime { my ($self, $c, $id) = @_; my $mime_content = $c->model('SomeModel')->get_content_by_id($id) or return undef; return Email::MIME->new($mime_content); } 1;
Then, access URLs like the following to view MIME objects:
# View MIME object with id '1234' http://localhost:3000/mimeview/view/1234 # View part 1 of a MIME object with id '1234' http://localhost:3000/mimeview/view/1234/1 # View part 3 of part 1 of a MIME object with id '1234' http://localhost:3000/mimeview/view/1234/1/3 # Download MIME object with id '1234' http://localhost:3000/mimeview/content/1234
Quick and dirty Catalyst Controller interface for viewing MIME objects, including multipart MIME objects with rich content and embedded images, such as those typically generated by rich-text E-Mails and MHTML files. This module might be used as an E-Mail viewer, but can also be used to view any MIME content, including *.mht files, image attachments, and so on.
Method to be defined in consuming class used to resolve an id into an Email::MIME object. Must return an Email::MIME object. See Synopsis above for example.
Alternative way to supply the get_mime() method as a CodeRef that can be passed as a config param. If defined, the real get_mime method will be ignored.
get_mime()
Bool option for debug purposes. Allows calling methods on the Email::MIME object directly and dumping the output. For example:
# Dump the output of $MIME->debug_structure() for id '1234' http://localhost:3000/mimeview/method/debug_structure/1234/
Defaults to false (0).
* Define a View API and write proper View classes * Document the controller actions * Write tests
Henry Van Styn <vanstyn@cpan.org>
This software is copyright (c) 2013 by IntelliTree Solutions llc.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Catalyst::Controller::MIME, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Controller::MIME
CPAN shell
perl -MCPAN -e shell install Catalyst::Controller::MIME
For more information on module installation, please visit the detailed CPAN module installation guide.