1#!/usr/bin/perl 2# -*- Mode: perl -*- 3# file: movie 4# Moviedb "movie" display 5 6use strict; 7use lib '..'; 8use vars '$DB'; 9use Ace 1.51; 10use Ace::Browser::AceSubs; 11 12use CGI 2.42 qw/:standard :html3 escape/; 13 14my $movie = GetAceObject(); 15 16PrintTop($movie,'Movie'); 17print_prompt(); 18AceNotFound() unless $movie; 19print_report($movie); 20PrintBottom(); 21 22exit 0; 23 24sub print_prompt { 25 print 26 start_form(), 27 p("Database ID", 28 textfield(-name=>'name'), 29 hidden(class=>'Movie'), 30 ), 31 end_form; 32} 33 34sub print_report { 35 my $movie = shift; 36 37 print h2($movie->Title); 38 print p("Directed by ",map { ObjectLink($_,$_->Full_name) } $movie->Director); 39 print table( 40 TR({-align=>'LEFT'}, 41 th('Released'), 42 td($movie->Released)), 43 TR({-align=>'LEFT'}, 44 th(em('Starring')), 45 td(map { ObjectLink($_,$_->Full_name) } $movie->Cast)), 46 TR({-align=>'LEFT'}, 47 th(em('Writer(s)')), 48 td(map { ObjectLink($_,$_->Full_name) } $movie->Writer)), 49 $movie->Based_on ? 50 (TR({-align=>'LEFT'}, 51 th(em('Adapted from')), 52 td(map { ObjectLink($_,$_->Title) } $movie->Based_on))) 53 : '', 54 ); 55} 56