Académique Documents
Professionnel Documents
Culture Documents
3. (12.3) Rewrite the Perl finger CGI script shown in Figure 12.2 (see below) to
include both appropriate input validation and more informative error messages,
as suggested by footnote 3 in Section 12.2. Extend the input validation to also
permit any of the characters: -+% in the middle of $user value, but not at eithe
r the start or end of this value.
#!/usr/bin/perl
# finger.cgi ¨C finger CGI script using Perl?s CGI module
use CGI;
use CGI::Carp qw(fatalsToBrowser);
$q = new CGI; # create query object
# display HTML headers
print $q->header,
$q->start_html(?Finger User?),
$q->hl(?Finger User?);
print ¡°<pre>¡±;