jdtoronto has asked for the wisdom of the Perl Monks concerning the following question:

Esteemed Monks,

It as but moments after I sent my last question that somebody raised the spectre of HTML emails. Situation is this, I have a contact management product (custom job for a client) which is rather nice and is all done in Perl/Tk packaged with PerlApp (from ActiveState) and uses MySQL. We want to embed an email client package into it and I have written all the basics using Net::SMTP and Net::Pop3. The idea is to have an email system that keys the email to an individuals records - rather than the amorphous mess of Outlook or Eudora.

Now I have been asked if it is possible to render HTML. I gather this arises because even Outlook and Eudora use HTML mark-up to do 'styled' text. I think that even Eudora doesn;t do its own HTML rendering, it uses the browsers rendering engine. Is it possible to do this within a Perl Application? Preferably one using Tk?

Any help appreciated!

jdtoronto

Replies are listed 'Best First'.
Re: Perl/Tk application rendering HTML?
by kvale (Monsignor) on Feb 24, 2005 at 22:11 UTC

      Sure would be nice if that module's writer/maintainer would include some sort of useful documentation...


      --
      Linux, sci-fi, and Nat Torkington, all at Penguicon 3.0
      perl -e 'print(map(chr,(0x4a,0x41,0x50,0x48,0xa)))'
      I've been looking for a similar 'embedded' browser myself. I've implemented this on win32 using Delphi/Active-X/Explorer - very simple and renders pages same as Internet Explorer (JavaScript runs etc). It is possible to do this with Mozilla if you don't want explorer. After much googling I came to the conclusion that there was not a perl solution out there for *nix that was -easy- to use. I found a Java solution but I did not spend much time on it.
      Maybe it does, but only for those who know how in heck it works, or how to use it. Oh sorry, if someone knew that they must have been killed already.

      Do you have any example code Mark?

      jdtoronto

        Tk::HTML does indeed come with some "hidden" documentation.
        However, I noticed it renders HTML horribly.

        Here you can find the example code from the module and see it with your own eyes...
        If you were using WxWidgets or Win32::GUI (and assuming you're in Win32 environment), you could use either Wx::ActiveX or Win32::GUI::AxWindow in order to create a Internet Explorer component that does the rendering for you.

        Maybe you could write a XS extension exntending Tk. ;)
        It shouldn't be a big problem, since Tcl::Tk documentation states that Tcl/Tk already supports creating ActiveX widgets.


        acid06
        perl -e "print pack('h*', 16369646), scalar reverse $="
        Sorry, not really. I downloaded it once, ran tkweb, filed it away in my memory, never to use it again. I would advise studying the tkweb source as a way to get a handle on module.

        -Mark