object: to convert my personal movie list to HTML on the fly via CGI.
#! /usr/bin/perl -w
use 5.005
use CGI qw(:standard *table);
$TITLE = "Movie List";
print header, start_html($TITLE), h1($TITLE);
open (MOVIELIST, "/export/home/mydir/movie.list") || die "NO GO ($!)";
print table({-border=>undef},
Tr({-align=>CENTER,-valign=>TOP},
[
th(['Title', 'Genre','Rateing','Time','Production Company']),
while (<MOVIELIST>) {
($TITLE,$GENRE,$RATEING,$TIME,$PROD_CO)=split(/:/, $_);
td(['$TITLE' , '$GENRE' , '$RATEING' , '$TIME' , '$PROD_CO']),
};
]
)
);
# EXAMPLE
# print table({-border=>undef},
# caption('When Should You Eat Your Vegetables?'),
# Tr({-align=>CENTER,-valign=>TOP},
# [
# th(['Vegetable', 'Breakfast','Lunch','Dinner']),
# td(['Tomatoes' , 'no', 'yes', 'yes']),
# td(['Broccoli' , 'no', 'no', 'yes']),
# td(['Onions' , 'yes','yes', 'yes'])
# ]
# )
# );
ERRORS:
syntax error at ./movie.cgi line 18, near "foreach "
syntax error at ./movie.cgi line 21, near "}"
Execution of ./movie.cgi aborted due to compilation errors.
SAMPLE movie.list:
Godfather I:Crime, Drama:R:175:Paramount
Godfather II:Crime:R:200:Paramount
Godfather III:Crime:R:161:Paramount
Young and Dangerous 1:Action, Adventure:IIB:99:Mei Ha Laser Disk Co
Young and Dangerous 2:Action, Adventure:IIB:99:Mei Ha Laser Disk Co
Young and Dangerous 3:Action, Adventure:II:98:Universe Laser & Video Co
Young and Dangerous 4:Action, Adventure:III:109:Mei Ha Laser Disk Co
Young and Dangerous 5:Action, Adventure:IIB:115:Universe Laser & Video Co
Young and Dangerous Prequel:Action, Adventure:III:115:Universe Laser & Video Co