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