Apache-Blog

 view release on metacpan or  search on metacpan

Blog.pm  view on Meta::CPAN

		# 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

	# need a filename. we start at 1 and move upwards. there's
	# almost certainly a race condition here, but this is written
	# for my site where i get about one comment a week. if yours is
	# so busy you're worried about this breaking, then feel free to
	# fix it.
	my @existing_files = glob("$comment_dir/*");
	my $new_basename = scalar(@existing_files) + 1;

	open (COMMENT, ">$comment_dir/$new_basename");
	print COMMENT "$name\n";
	print COMMENT scalar(localtime)."\n";
	print COMMENT $comment;
	close COMMENT;



( run in 0.244 second using v1.01-cache-2.11-cpan-87723dcf8b7 )