Help for this page

Select Code to Download


  1. or download this
    1. #!c:/perl/bin/perl -w
    2. $|++;
    ...
    3. use strict;
    4. use CGI::Simple;
    5. use HTML::Template;
    
  2. or download this
    7. my $q = CGI::Simple->new;
    8. my $t = HTML::Template->new( filehandle => *DATA );
    
  3. or download this
    10. my @ext = qw( pl css htm html shtm shtml );
    11. my $file = $q->param('file');
    12. my $fh;
    
  4. or download this
    14. if (
    15.   ($file =~ /[^a-zA-Z0-9_\-\.]/) or
    ...
    18.   !(-e $file) or
    19.   !(open $fh, '<', $file) or
    20. ) {
    
  5. or download this
    21.   $t->param(
    22.     title => 'My File Viewer',
    ...
    32.     code  => do { local $/; <$fh> }
    33.   );
    34. }
    
  6. or download this
    36. print $q->header, $t->output;
    37. exit;