Like other things posted here without notices to the contrary, this code is in the public domain.
So some LiveJournal meme was going around --- this list of 100 movies where you'd bold the ones you'd seen and post it on your journal. So I wrote a CGI script to make it easier, which was pretty silly. Clearly the task doesn't justify the amount of code devoted to it here, either by its usefulness or its complexity. I wonder what language would make this task easier to express? #!/usr/bin/perl -wT use strict; use CGI qw(-nosticky); my $titles = <<EOM; Godfather, The (1972) Shawshank Redemption, The (1994) Godfather: Part II, The (1974) Lord of the Rings: The Return of the King, The (2003) Lord of the Rings: The Two Towers, The (2002) Casablanca (1942) Schindler's List (1993) Shichinin no samurai (1954) Lord of the Rings: The Fellowship of the Ring, The (2001) Citizen Kane (1941) Star Wars (1977) One Flew Over the Cuckoo's Nest (1975) Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb (1964) Rear Window (1954) Star Wars: Episode V - The Empire Strikes Back (1980) Raiders of the Lost Ark (1981) Memento (2000) Usual Suspects, The (1995) Pulp Fiction (1994) North by Northwest (1959) Fabuleux destin d'Amelie Poulain, Le (2001) Psycho (1960) 12 Angry Men (1957) Lawrence of Arabia (1962) Silence of the Lambs, The (1991) Buono, il brutto, il cattivo, Il (1966) It's a Wonderful Life (1946) Goodfellas (1990) American Beauty (1999) Vertigo (1958) Sunset Blvd. (1950) Pianist, The (2002) Matrix, The (1999) Apocalypse Now (1979) To Kill a Mockingbird (1962) Some Like It Hot (1959) Taxi Driver (1976) Paths of Glory (1957) Third Man, The (1949) C'era una volta il West (1968) Fight Club (1999) Boot, Das (1981) Sen to Chihiro no kamikakushi (2001) (Spirited Away) Double Indemnity (1944) L.A. Confidential (1997) Chinatown (1974) Singin' in the Rain (1952) Requiem for a Dream (2000) Maltese Falcon, The (1941) M (1931) All About Eve (1950) Bridge on the River Kwai, The (1957) Monty Python and the Holy Grail (1975) Se7en (1995) Saving Private Ryan (1998) Cidade de Deus (2002) Raging Bull (1980) Wizard of Oz, The (1939) Rashomon (1950) Sting, The (1973) American History X (1998) Alien (1979) Mr. Smith Goes to Washington (1939) Leon (The Professional) (1994) 2001: A Space Odyssey (1968) Vita bella, La (1997) (Life Is Beautiful) Touch of Evil (1958) Manchurian Candidate, The (1962) Wo hu cang long (2000) (Crouching Tiger Hidden Dragon) Treasure of the Sierra Madre, The (1948) Great Escape, The (1963) Clockwork Orange, A (1971) Reservoir Dogs (1992) Annie Hall (1977) Amadeus (1984) Jaws (1975) Ran (1985) On the Waterfront (1954) Modern Times (1936) High Noon (1952) Braveheart (1995) Apartment, The (1960) Sixth Sense, The (1999) Fargo (1996) Aliens (1986) Shining, The (1980) Blade Runner (1982) Strangers on a Train (1951) Duck Soup (1933) Metropolis (1927) Finding Nemo (2003) Donnie Darko (2001) Toy Story 2 (1999) Princess Bride, The (1987) General, The (1927) City Lights (1931) Lola rennt (1998) Full Metal Jacket (1987) Notorious (1946) Sjunde inseglet, Det (1957) EOM my @titles = split /\n/, $titles; my $q = CGI->new(); sub movie { my ($q, $index) = @_; my $seen = $q->param("s$index"); my $text = $index + 1 . " " . $titles[$index]; return ($seen ? $q->b($text) : $q->escapeHTML($text)); } print $q->header; if ($q->param('gen')) { print($q->start_html("Movies you've seen"), $q->h1("Movies you've seen"), $q->start_form, "\n"); my $url = $q->url; my $htmlfrag = ('<p>' . (join("<br />\n", map { movie($q, $_) } (0..$#titles)) . "</p>\n" . qq(<p><a href="$url"><font size="-1">Which movies have you seen?</font></a></p>))); print $htmlfrag, qq(<p><font size="-2">Paste this code into your web page:</font><br />), $q->textarea(-name => 'html', -default => $htmlfrag, -rows => 4, -columns => 40, -wrap => 'soft'), "</p>\n", $q->end_form(), $q->end_html(), "\n"; } else { print($q->start_html("Which movies have you seen?"), $q->h1("Which movies have you seen?"), $q->start_form(-method => 'GET'), "\n"); for (0..$#titles) { print $q->checkbox(-name => "s$_", -label => $titles[$_], -value => 1), "<br />\n"; } print $q->submit('gen', 'Go!'), $q->end_form(), $q->end_html(), "\n"; }