package static_helper; my $password = 'secret'; my $config_dir = '/etc/blosxom'; my $needs_rebuild; my @files; sub start { @files = (); $needs_rebuild = 0; return 1; } sub regenerate { my ($fn, $flavour) = @_; my $path_info = "$blosxom::static_dir/$fn"; my $file = "$blosxom::static_dir/$fn.$flavour"; $needs_rebuild = 1; push @files, $file; } sub end { return 1 unless $needs_rebuild; foreach $file (@files) { if (-e $file) { unlink($file) or warn "Could not delete file: $file. $!" } } my $pid = fork(); if (!$pid) { # child close STDIN; open STDIN, "/tmp/child.stdout"; close STDERR; open STDERR, ">/tmp/child.stderr"; %ENV = ( 'BLOSXOM_CONFIG_DIR' => $config_dir ); @args = ('/usr/bin/perl', 'blosxom.cgi', "-password=$password"); exec @args or warn "Couldn't run @args: $!"; exit 0; } else { return 1; } } 1;