chrimble's Journal chrimble's use Perl Journal en-us use Perl; is Copyright 1998-2006, Chris Nandor. Stories, comments, journals, and other submissions posted on use Perl; are Copyright their respective owners. 2012-01-25T02:30:56+00:00 pudge Technology hourly 1 1970-01-01T00:00+00:00 chrimble's Journal Template Toolkit <p>I've been using Template Toolkit for the past two or three years now, and it is truly a marvel. But yesterday, I was asked by a coworker if it was easy to include a datastructure dump in the output containing all variables passed to a template object in the process call without having to do anything reciprocally to the back-end code (for the purposes of debugging). I wasn't sure, but it didn't sound <i>too</i> unreasonable, so I said I'd take a look.</p><p>After trundling through the documentation, getting unhelpful advice on IRC (shock horror!) and finally delving into the stash and poking around a bit, it became apparent that lots of things become intermingled in the generation process that I hadn't previously appreciated (leading to potentially unexpected results such as <code>perl -we'use Template; Template-&gt;new-&gt;process(\"c:[% component %] f:[% foo %]", { component =&gt; "oops", foo =&gt; "bar" })'</code>). So at least the short answer to the question would appear to be "no".</p><p>Of course, a solution involving embedding perl stash traversal code directly into the template or even writing a template plugin would be doable at a push, it's almost certainly not worth doing if you have access to the back end code.</p> chrimble 2003-11-05T11:10:33+00:00 journal Class::DBI <p>I've been having a great time playing with <a href="">Class::DBI</a> these past few days. Although I've been vaguely aware of it for a while, I hadn't really considered using it till I read <a href="">Kake's article</a> on, and realised that it might be suitable for use in the project I'm currently working on (which had until that point used a more traditional vanilla DBI implementation).</p><p>Talk about straightforward - it took about two minutes to set up, and it all worked first time. If only everything were that easy.<nobr> <wbr></nobr>;-)</p><p>There are only two things I still need to work out before I'm completely happy.</p><p>Firstly, it doesn't seem to want to play nicely with Apache::Reload, at least at first glance. So I'm back to an apache stop/start cycle, at least whenever I update the database declarations. Knowing me, I'm missing something blindingly obvious, but it'd still be nice to sort it out. Though in the grand scheme of things, it's really not that big a deal.</p><p>The second issue is that I currently don't know exactly how much performance overhead it incurs, so I need to write some benchmarks. Whilst I have a feeling it's going to be quite a bit (considering what it does), I want to know exactly how much, as compared to plain DBI. OK, yeah, premature optimisation and all that, but it'd be nice to know what to expect before I start hammering it for real.<nobr> <wbr></nobr>;-)</p> chrimble 2003-07-24T10:46:50+00:00 journal Batik Rasterizing <p>SVG is great fun. Gone are the days of faffing about in the Gimp trying to make consistant-looking buttons for my website - now it's simply a matter of knocking out a quick script that outputs some appropriate SVG ready for conversion into a bitmap format.</p><p>For that purpose, I use the batik rasteriser. Whilst it's java-based and no speed demon, it produces some nice output, and it's fairly easy to get good results. Unfortunately, it also requires a connection to an X server as it relies on the AWT for some of its functions - even the command line tools such as the rasterizer. Nothing appears on the screen - it just needs the X connection otherwise a fatal exception is raised.</p><p>So I've been down a merry "xhost + [machine]" route whilst setting the DISPLAY environment variable to point back my workstation from the development box (no X). This is officially Inconvenient, and I've been grumbling about it for a while. The previous official "solution" to this problem was to set up xvfb and use that. Again, Inconvenient.</p><p>Happily though, today I found a proper solution. Java 1.4 has introduced a "headless" mode which can be activated by adding a simple "-Djava.awt.headless=true" flag to the java call that runs the rasterizer. Yay!</p><p>So I thought I'd put it here in case I needed to remember it again.<nobr> <wbr></nobr>;-)</p> chrimble 2003-06-25T14:36:31+00:00 journal SVG. Pfft. <p>I've been working on a system that draws pretty graphs using SVG (via And I've reached the point where the output is really quite nice.</p><p>The only black cloud on the horizon is that I have to incorporate the generated graphs into a Word document. Rasterizing the graphs looks really ugly, and whilst generating larger-than required images and scaling them down provides acceptable results when printed, the on-screen display is terrible.</p><p>I've therefore spent most of the day trying to work out how I can convert my SVG images to something like EPS. In theory, it should be possible, but in practice? Not on your nelly.</p><p>At least, not on *my* nelly.</p><p>I've tried Batik, ImageMagick, Ghostscript... All come to naught, in one way or another. I'm really not sure what to do now. I suspect it might be back to the drawing-board, so to speak...</p><p>SVG is pretty nice to play with though - at least, when you don't have to incorporate output into anything else... 8)</p> chrimble 2003-02-17T17:25:54+00:00 journal Curses <p>Currently trying to get my head around Curses::UI at the moment, and am feeling slightly flummoxed as a result.</p><p>I think I prefer Curses::UI as compared to Curses::Widgets, as it seems to work slightly better on my terminal, or at least the demo scripts do, and there seems to be slightly more documentation available for it.</p><p>I just wish I was slightly more clueful in this area and was more confident that I was heading in the right direction.</p> chrimble 2003-02-03T10:50:07+00:00 journal Perl and MacOS X As I continue my gradual acclimatisation with MacOS X, I find that I've done certain things that now I wish I hadn't. Chief amongst these is stomping over the default Perl 5.6.0 installation with 5.8.0. <p> With retrospect, this probably wasn't a terribly bright thing to do. I could restore 5.6.0, but as I've only just got my mod_perl (with AxKit) setup working nicely I really don't want to go through the rigmarole of re-diddling everything to work in separate areas. </p><p> Oh, but for the want of a little foresight...</p> chrimble 2002-12-27T02:12:06+00:00 journal Ok. Here we go. <p>Well, whilst I already keep an online journal of sorts over <a href="">here</a>, I don't really have anywhere appropriate to blather on about perly stuff (however tenuous the relationship). So I'll try sticking it here, and see how it goes.</p><p>Not that I have anything particularly to mention right now of course, but "one step at a time" and all that.</p> chrimble 2002-12-17T12:59:29+00:00 journal