Apache-Blog
view release on metacpan or search on metacpan
# it's fair enough in this case.
$template->param( %$entry );
# entry is the only method that actually does something, rather
# than doing "return shift->{'whatever'}", so we need explicitly
# run it.
$template->param( entry => $entry->entry);
# need to find the next and previous entries too
my @all = Apache::Blog::Entry->get_all( dirname($r->filename) );
# this looks like an overly complicated way of finding out the
# index in @all (which was got in the last line) of this entry
# is. we do that so we can tell what the one after it, and the
# one before it are, so we can have links to them.
my $this_index = 0;
$this_index++ while (defined($all[$this_index]) && $all[ $this_index ]->filename ne $entry->filename);
# previous
if (defined($all[$this_index+1])){
$template->param( prev => $all[$this_index+1]->filename );
} else {
my $r = shift;
my $apr = Apache::Request->new($r);
my $name = $apr->param('name');
my $comment = $apr->param('comment');
my $filename = $apr->param('filename');
# if the comment directory doesn't exist, we should create it
my $comment_dir = dirname($r->filename)."/$filename-comment";
if (!-d $comment_dir) {
# looks like perl 5.6.1 doesn't need the permissions bit
# on mkdir, but perl 5.005_03 does. great fun when your
# perl -c is 5.6.1, but your mod_perl is 5.005_03.
# perhaps this should tell me something about my
# development environment. perhaps i shouldn't be so
# liberal here with the permissions either.
unless (mkdir($comment_dir, 0755)) {
$r->log_reason("Can't create $comment_dir: $!");
return SERVER_ERROR;
} # end mkdir
} # end no directory
( run in 0.483 second using v1.01-cache-2.11-cpan-64827b87656 )