in reply to Sendmail Aliases to HTML?

open(HF,">aliases.html") or die "$!"; open(AF,"</etc/aliases") or die "$!"; print HF "<HTML><HEAD><TITLE>Our new alaises</TITLE></HEAD><BODY><PRE> +"; while (<AF>) {print HF;} print HF "</PRE></BODY></HTML>"; close(HF) or die "$!"; close(AF) or die "$!";
Update:merlyn is right as usual. I don't put <,> or & in my /etc/aliases, just plain Postmaster: root stuff... Sorry.

Change the while (<AF>) {print HF;} to
while (<AF>) { s/&/&amp;/g; s/</&lt;/g; s/>/&gt;/g; print HF;}
That will make it "semi-encoded" and not break on >,< or &.

merlyns solution with LWP is a better one of cause, but the above might be good enough if you don't have and don't want to install LWP.

/brother t0mas

Replies are listed 'Best First'.
RE: RE: Sendmail Aliases to HTML?
by merlyn (Sage) on Aug 23, 2000 at 16:56 UTC
    That fails if there are any less-thans, greater-thans, or ampersands in the text. And HTML has no equivalent to our <code> tags. {grin} So, you need to entitize the file. If you've got LWP installed, that's trivial. See the snippet I just added: Convert text file to HTML.

    -- Randal L. Schwartz, Perl hacker