Toxic Elephant

Getting Bryar to work: A Summary

Posted by matijs Mon, 11 Oct 2004 12:40:00 GMT

As I mentioned, installing Bryar was not completely straightforward. Luckily, it is architected well, so making the necessary modifications was easy.

First, comments didn’t work. Clicking the comments link simply returned the same page. After some digging through the templates, and then through the Template Toolkit documentation to find out how templates worked, it turned out the toolkit was unable to access bryar.arguments (where the CGI parameters live). As a result, the template toolkit couldn’t access the CGI parameters, so it couldn’t know it was supposed to show the comments.

I subclassed Bryar::Renderer::TT to pass the parameters as a separate variable to the toolkit. I still don’t know why the original didn’t work. [Update: Now I know. It is a known bug.]

Putting the date inside the entry’s file worked (using Bryar::DataSource::FlatFile::Dated), but only if I entered it in seconds since the epoch. So, I wrote a <a href=”/software/bryar/ParsedDate.pm”>different subclass of Bryar::DataSource::FlatFile, one that parses the first line as a date using Data::Parse.

The blog now worked, but it was slow: it took two seconds on the 333 MHz Celeron laptop that is now my blog server. To fix this, I made <a href=”/software/bryar/ModPerl2.pm”>a port of the mod_perl frontend to mod_perl2 (I use Apache 2). I also modified it somewhat: there is now a separate <a href=”/software/bryar/BryarDriver.pm”>BryarDriver class that simply calls Bryar->go(), essentially replacing bryar.cgi. This makes things a lot cleaner, I think. [Update: Since the mod_perl2 API went through some changes, there is now a version for mod_perl2 before version 1.999.23 and a version for later versions of mod_perl2.]

Finally, the atom feed was broken: the code that filled the summary field didn’t take into account that it’s possible for HTML tags to be spread out over multiple lines. Luckily, this was easily fixed by modifying the template to first collapse each entry to a single line.

Posted in ,  | no comments | no trackbacks

No comments

No trackbacks

Comments are disabled

Toxic Elephant is Matijs van Zuijlen's weblog.

Powered

Categories

Archives