Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

HTML to MHT conversion programmatically

97 views
Skip to first unread message

Vincent Belaïche

unread,
Apr 24, 2013, 2:24:10 AM4/24/13
to Vincent Belaïche
Hello,

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.

Vincent.

Ben Morrow

unread,
Apr 24, 2013, 5:12:22 AM4/24/13
to

Quoth vincent....@gmail.com (Vincent =?iso-8859-1?Q?Bela=EFche?=):
>
> 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.

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.

> Also I found quite a few HTML parsers, but
> I don't know which one is the most suited.

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.

> 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.

So try to write something, and, if you get stuck, post again.

Ben

Vincent Belaïche

unread,
Apr 24, 2013, 9:02:39 AM4/24/13
to Vincent Belaïche
Thank you so much with the quick feedback. I will try that. Whether I am
stuck or not I will anyway make it public --- because writing functional
code, does not mean that the code is well written.

VBR,
Vincent.

johannes falcone

unread,
Apr 25, 2013, 7:02:03 PM4/25/13
to
downlaod opera

open html in opera

saev as mht

DONE

Vincent Belaïche

unread,
May 11, 2013, 6:47:01 AM5/11/13
to Vincent Belaïche
johannes falcone <vispha...@gmail.com> writes:


[...]


>> Any feedback or help is welcome.
>>
>>
>>
>> Vincent.
>
> downlaod opera
>
> open html in opera
>
> saev as mht
>
> DONE

Thank you for the feedback, this is what I am doing, but I wanted to do
that programmatically. Sorry if my first email was not clear enough.

Vincent.

Henry Law

unread,
May 11, 2013, 7:43:23 AM5/11/13
to
On 11/05/13 11:47, Vincent Bela�che wrote:
> Thank you for the feedback, this is what I am doing, but I wanted to do
> that programmatically. Sorry if my first email was not clear enough.

Your mail was perfectly clear. To most of us.

--

Henry Law Manchester, England
0 new messages