-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstatic_notfound
51 lines (36 loc) · 941 Bytes
/
static_notfound
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Blosxom Plugin: static_notfound
# Author: Kyo Nagashima <[email protected]>, http://hail2u.net/
# Version: 2012-07-13
# Blosxom Home/Docs/Licensing: http://blosxom.sourceforge.net/
package static_notfound;
use strict;
use warnings;
# --- Configurable variables -----------
my $notfound_path = '/Library/WebServer/Documents/404.html';
my $content_type = "text/html; charset=$blosxom::blog_encoding";
# --- Plug-in package variables --------
my $stories = 0;
my $content = '<!DOCTYPE html><title>404 Not Found</title><p>404 Not Found';
# --------------------------------------
sub start {
return 1;
}
sub story {
$stories++;
return 1;
}
sub last {
if ($stories) {
return 1;
}
if (open(my $fh, '<', $notfound_path)) {
local $/;
$content = <$fh>;
}
$blosxom::header->{-type} = $content_type;
$blosxom::header->{-status} = '404 Not Found';
$blosxom::output = $content;
return 1;
}
1;
# vim:ft=perl