Category: | Miscellaneous |
Author/Contact Info | |
Description: | This program reads all *.pl files in a given directory and then outputs the script followed by the results to an html file. Any suggestions for improvements, or added robustness would be much appreciated. |
#!/usr/bin/perl (@files)=<*.pl>; foreach my $file(@files){ my ($filestart)=$file=~/(.*?)\./; open INPUT, $file; my $source; while (<INPUT>){ $source.=$_; } close INPUT; $program=$source; $source=~s/</</g; $source=~s/>/>/g; open FILE, ">$filestart.html"; *STDOUT=*FILE; print "<HTML><BODY bgcolor=ffffff>\n"; print "<PRE><CODE>"; print $source; print "</CODE"."></PRE>"; print "<B>Program results:</B>"; print "<PRE>"; eval $program; print "</PRE>"; print "</BODY></HTML>"; close FILE; } |
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Code + Results to HTML
by dws (Chancellor) on Feb 25, 2001 at 04:27 UTC | |
Re: Code + Results to HTML
by TheoPetersen (Priest) on Feb 25, 2001 at 03:48 UTC |
Back to
Code Catacombs