[H-GEN] A perl query
Conor Cunningham
cunningtek at optusnet.com.au
Sun May 4 01:31:32 EDT 2003
[ Humbug *General* list - semi-serious discussions about Humbug and ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]
Hey Joe,
I may have sent a msg to you or the list earlier which was extremely
incomplete. Sorry, hit the wrong button. Bit messy this morning.
Anyway, I was going to suggest that you might want to look at the CGI
module which allows you to do some neat Object Orientated perl HTML stuff.
i.e.
use CGI;
#go through each line of logfile
foreach $line <LOGFILE> {
chomp $line; #remove and non character spaces from the end of the
line, i.e \n or \t
$line = s/SEARCH/REPLACE/gi; #substitute regular expression
$final = $line;
} #thats one way of reading a file
#the use CGI is necessary for this part.
print $q->header("text/html"),
$q->start_html(-title=> "Your Log Page", -bgcolor=> "#CCCCCC"),
$q->h2("Log File"),
$q->hr,
$q->br,
$q->a({-href=>"../login.htm"}, "Please Return to the Login Page"),
# a link
$q->p("print any variables here i.e $final"),
$q->br,
$q->hr,
$q->end_html;
#this will print HTML code to your browser if done on the web and create
HTML on the fly, or if you run it from the prompt it will print it to <STDOUT>
so if you perl -w yourfile.pl > myhtml.html
you can put all your html into a file ready for action.
Hope that this is of some assistance to you.
--
Regards,
Conor Cunningham
Managing Director
Cunningtek Technologies
ABN: 92 097 126 695
cunningtek at optushome.net.au
0411 545 998
DIGITAL FINGERPRINT
4E60 84BD 62A6 5527 F2A7 3F34 1B24 AB4A 25D6 E03B
--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'. See http://www.humbug.org.au/
More information about the General
mailing list