#!/usr/bin/perl -T # Copyright (C) 2007 王亮 # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public Licence as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public Licence for more details. use CGI; use File::Find; use File::Basename; use File::Spec::Functions qw(splitdir); use URI::Escape; use HTML::Entities; sub print_book_with_link { my $filename = shift; $filename =~ s{^\./}{}; my @dirs = splitdir(dirname($filename)); my $path = join '/', map { uri_escape($_) } @dirs; my $title = basename($filename); my $url = "$path/" . uri_escape($title); if ($title =~ /^(?:ch(?:apter)?)?\d+\.(?:chm|pdf)$/i || $filename =~ /Object-Oriented Construction/i) { $title = $filename; } print qq(
  • $title
  • ); } my $cgi = CGI->new; my $date_range = $cgi->param('date'); if (! defined $date_range || $date_range !~ /[0-9]+/) { $date_range = 7; } print $cgi->header(-charset => 'utf-8'), $cgi->start_html("New books within $date_range dates"), $cgi->h1("New books within $date_range dates"); print qq(\n"; print $cgi->hr; print "\n"; print $cgi->end_html;