| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Blosxom::Include; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
2993
|
use strict; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
126
|
|
|
4
|
3
|
|
|
3
|
|
4272
|
use Filter::Simple; |
|
|
3
|
|
|
|
|
103948
|
|
|
|
3
|
|
|
|
|
27
|
|
|
5
|
3
|
|
|
3
|
|
3790
|
use FileHandle; |
|
|
3
|
|
|
|
|
15318
|
|
|
|
3
|
|
|
|
|
22
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
1491
|
use vars qw($VERSION); |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
1486
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$VERSION = 0.002000; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $include_pattern = qr/^#?\s*(?:IncludeConfig|__END_CONFIG__).*$/m; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
FILTER { |
|
14
|
|
|
|
|
|
|
my ($self, $plugin_name) = @_; |
|
15
|
|
|
|
|
|
|
return unless m/$include_pattern/; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Try and figure out $config_dir in the same way as blosxom itself |
|
18
|
|
|
|
|
|
|
my $config_dir = ''; |
|
19
|
|
|
|
|
|
|
if ($ENV{BLOSXOM_CONFIG_FILE}) { |
|
20
|
|
|
|
|
|
|
($config_dir = $ENV{BLOSXOM_CONFIG_FILE}) =~ s! / [^/]* $ !!x; |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
unless (-d $config_dir) { |
|
23
|
|
|
|
|
|
|
for my $blosxom_config_dir ($ENV{BLOSXOM_CONFIG_DIR}, '/etc/blosxom', '/etc') { |
|
24
|
|
|
|
|
|
|
if (-d $blosxom_config_dir) { |
|
25
|
|
|
|
|
|
|
$config_dir = $blosxom_config_dir; |
|
26
|
|
|
|
|
|
|
last; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Load plugin config data |
|
32
|
|
|
|
|
|
|
if ($config_dir && -d $config_dir && |
|
33
|
|
|
|
|
|
|
$plugin_name && -f "$config_dir/$plugin_name" && |
|
34
|
|
|
|
|
|
|
-r "$config_dir/$plugin_name") { |
|
35
|
|
|
|
|
|
|
if (my $fh = FileHandle->new( "$config_dir/$plugin_name", 'r' )) { |
|
36
|
|
|
|
|
|
|
local $/ = undef; |
|
37
|
|
|
|
|
|
|
my $plugin_config = <$fh>; |
|
38
|
|
|
|
|
|
|
if (defined $plugin_config) { |
|
39
|
|
|
|
|
|
|
my ($before, $after) = split $include_pattern; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# Munge the line count to include $plugin_config |
|
42
|
|
|
|
|
|
|
my $line_count = ($before =~ tr/\n//); |
|
43
|
|
|
|
|
|
|
$line_count += ($plugin_config =~ tr/\n//); |
|
44
|
|
|
|
|
|
|
$line_count++; |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# Insert config and revised line count |
|
47
|
|
|
|
|
|
|
$_ = $before . $plugin_config . "# line $line_count\n" . $after; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
close $fh; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
}; |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |