All pastes #78574 Raw Edit

Something

public text v1 · immutable
·published 2006-07-04 08:08 UTC
rendered paste body
#!/usr/bin/perl
use strict;
use CGI qw/param/;
use CGI::Carp qw/fatalsToBrowser/;

my $file = $ENV{'REQUEST_URI'};
$file = '/index.html' if $file eq '/';
my $root = '/share/immute/htdocs';

my $files = '/files';

my $top = '/top.htm';
my $left = '/left.htm';


print "Content-Type: text/html\n\n";
print "<!-- file = $file -->";

use Data::Dumper;
#print Dumper(\%ENV);

unless ($file =~ /\.html?$/) {
    p_file("$root/$files/$file");
    exit;
}

p_file("$root/$top");
p_file("$root/$left");
p_file("$root/$files/$file");

sub p_file {
    my $f = shift;
    open my $fh, '<', $f or die "Fileopen: $f because $!";
    print while <$fh>;
}