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/&/&/g;
s/</</g;
s/>/>/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
|