Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- HTML to MHT conversion programmatically
- Vincent Bela├»che
April 24, 2013, 6:24 am
rate this thread
I am a newbie in Perl. I have written only a few simples scripts, but
that could make me feel the power of the language.
Now, I am looking for some way to convert an HTML file and the
dependency thereof into an MHT archive. All the files are local on my
hard drive. I looked for that on the internet, in vain.
I thought that Perl is probably the best language to make it, and I
wondered whether that already exists or not. I could not find anything
such thing on the CPAN --- well there are Email::MIME or MIME::Entity
and Email::Sender for MIME encoding, but I am not sure whether they are
flexible enough to do an MHT archive, and I must admit that I am not
expert in MHT archive format. Also I found quite a few HTML parsers, but
I don't know which one is the most suited.
In a nutshell, there seems to be already all the building blocks to make
it in a few lines of code, however nothing ready to work off-the-shelf.
Any feedback or help is welcome.
Re: HTML to MHT conversion programmatically
Quoth firstname.lastname@example.org (Vincent Belache ):
The MHT format is just a multipart/related MIME entity, isn't it?
Creating one of those with one of the MIME modules should be entirely
straightforward. In this case I would probably recommend MIME::Entity
rather than one of the Email:: modules, because it will let you leave
the attached files as files and convert them on the fly when writing out
the completed email.
I would have thought HTML::LinkExtor is what you want in this case,
since all you need to do is find which additional files need archiving.
So try to write something, and, if you get stuck, post again.
- » anyone notice cpanm sometimes installs modules same version?
- — Next thread in » PERL Discussions