$datadir =~ s!/$!!; $plugin_dir =~ s!/$!!; $static_dir =~ s!/$!!;
# Fix depth to take into account datadir's path
-$depth and $depth += ($datadir =~ tr[/][]) - 1;
+$depth += ($datadir =~ tr[/][]) - 1 if $depth;
# Global variable to be used in head/foot.{flavour} templates
$path_info = '';
if ( $path_info[$#path_info] =~ /(.+)\.(.+)$/ ) {
$flavour = $2;
- $1 ne 'index' and $path_info .= "/$1.$2";
+ $path_info .= "/$1.$2" if $1 ne 'index';
pop @path_info;
} else {
$flavour = param('flav') || $default_flavour;
else {
eval { require $plugin };
}
- $@ and warn "error finding or loading blosxom plugin $plugin_name - skipping\n" and next;
+ $@ and warn "$@ error finding or loading blosxom plugin $plugin_name - skipping\n" and next;
$plugin_name->start() and ( $plugins{$plugin_name} = $on_off ) and push @plugins, $plugin_name;
}
shift @INC foreach @plugin_dirs;
foreach ( ('', split /\//, $path) ) {
$p .= "/$_";
$p =~ s!^/!!;
- $done{$p}++ and next;
- (-d "$static_dir/$p" or $p =~ /\.$file_extension$/) or mkdir "$static_dir/$p", 0755;
+ next if $done{$p}++;
+ mkdir "$static_dir/$p", 0755 unless (-d "$static_dir/$p" or $p =~ /\.$file_extension$/);
foreach $flavour ( @static_flavours ) {
my $content_type = (&$template($p,'content_type',$flavour));
$content_type =~ s!\n.*!!s;
# Plugins: Skip
# Allow plugins to decide if we can cut short story generation
- my $skip; foreach my $plugin ( @plugins ) { $plugins{$plugin} > 0 and $plugin->can('skip') and defined($tmp = $plugin->skip()) and $skip = $tmp and last; }
+ my $skip;
+ foreach my $plugin (@plugins) {
+ if ( $plugins{$plugin} > 0 and $plugin->can('skip') ) {
+ if ( my $tmp = $plugin->skip() ) {
+ $skip = $tmp;
+ last;
+ }
+ }
+ }
+
# Define default interpolation subroutine
$interpolate =
# Plugins: Interpolate
# Allow for the first encountered plugin::interpolate subroutine to
# override the default built-in interpolate subroutine
- my $tmp; foreach my $plugin ( @plugins ) { $plugins{$plugin} > 0 and $plugin->can('interpolate') and defined($tmp = $plugin->interpolate()) and $interpolate = $tmp and last; }
+ foreach my $plugin (@plugins) {
+ if ( $plugins{$plugin} > 0 and $plugin->can('interpolate') ) {
+ if ( my $tmp = $plugin->interpolate() ) {
+ $interpolate = $tmp;
+ last;
+ }
+ }
+ }
# Head
my $head = (&$template($currentdir,'head',$flavour));
# Plugins: Head
- foreach my $plugin ( @plugins ) { $plugins{$plugin} > 0 and $plugin->can('head') and $entries = $plugin->head($currentdir, \$head) }
+ foreach my $plugin (@plugins) {
+ if ( $plugins{$plugin} > 0 and $plugin->can('head') ) {
+ $entries = $plugin->head( $currentdir, \$head );
+ }
+ }
$head = &$interpolate($head);
# Plugins: Sort
# Allow for the first encountered plugin::sort subroutine to override the
# default built-in sort subroutine
- my $tmp; foreach my $plugin ( @plugins ) { $plugins{$plugin} > 0 and $plugin->can('sort') and defined($tmp = $plugin->sort()) and $sort = $tmp and last; }
+ foreach my $plugin (@plugins) {
+ if ( $plugins{$plugin} > 0 and $plugin->can('sort') ) {
+ if ( my $tmp = $plugin->sort() ) {
+ $sort = $tmp;
+ last;
+ }
+ }
+ }
foreach my $path_file ( &$sort(\%f, \%others) ) {
last if $ne <= 0 && $date !~ /\d/;