# The following code is a fix for a bug in Blosxom 3 which prevents # new flow handlers from being installed via the handlers.flow # file. It also contains a minor change to _interpolate to improve error # handling. To apply the fix, make a backup copy of Blosxom.pm. Then # replace the run_flow subroutine with the subroutine below of the # same name, replace handle_handlers with the new handle_handlers # plus synchronize_handlers, and replace _interpolate with the new version # of the same name. sub run_flow { my $self = shift; $self->{state}->{stop}->{handlers}->{flow} = 0; $self->{handlers_performed}->{flow} = []; no strict qw/subs refs/; while (my $handler = shift @{$self->{handlers}->{flow}} ) { last if $self->{state}->{stop}->{handlers}->{flow}; push(@{$self->{handlers_performed}->{flow}}, $handler); &$handler($self); } use strict qw/subs refs/; 1; } sub handle_handlers { my $self = shift; $self->{state}->{filehandle} ||= new FileHandle; my $fh = $self->{state}->{filehandle}; my @path_info_components = split /\//, $self->{request}->{path_info}; my $current_path = $self->{settings}->{find_entries_dir}; HANDLER_TYPE: foreach my $handler_type ( ('flow', 'entry') ) { HANDLER_FILE: foreach my $handler_file ( reverse @{$self->{handlers}->{found}->{$handler_type}} ) { if ( $fh->open("< $handler_file") ) { $self->{handlers}->{$handler_type} = []; while (<$fh>) { s/\#.*$//; s/\s+$//; push (@{$self->{handlers}->{$handler_type}}, $_) if $_; } $fh->close(); $self->synchronize_handlers if $handler_type eq 'flow'; last HANDLER_FILE; } } } 1; } sub synchronize_handlers { my $self = shift; my @performed = (); for my $performed ( @{$self->{handlers_performed}->{flow}} ) { my $handler = shift @{$self->{handlers}->{flow}}; if ($handler eq $performed) { push(@performed, $performed); } else { unshift(@{$self->{handlers}->{flow}}, $handler); last; } } $self->{handlers_performed}->{flow} = \@performed; } sub _interpolate { my( $hash, $var ) = @_; my @tiers = split /::/, $var; foreach my $tier ( @tiers[0..$#tiers] ) { return '' unless exists $hash->{ $tier }; $hash = $hash->{ $tier }; } $hash; }