Cool things at $work

Bernhard on 2005-07-09T14:00:41

My main project at $work is a Mason-based webapplication for keeping track of interesting biological sequences. As a new round of develoment is just starting, I finally took some time to do some refactoring and to beef up my test suite.

Almost all the application logic, interface to the database and connection to the world is wrapped in a set of Perl5 modules. Running the existing test suite with Devel::Cover was dead easy. It immediately showed me missing tests. Even better, it pointed me to some obsolete code. This is very good, as deleted code is guaranteed to be bugfree code.

The next toy was Test::TAP::HTMLMatrix. I think that there is no support from Module::Build yet, but I could avoid coding by fetching a script from . There is still some red in the generated HTML, but I blame it on the world, that keeps on changing.

In the left frame of the webapplication there is a project tree, that can contain several hundred nodes. This used to be a homegrown tree, but I replaced it with a COOLjsTree, http://javascript.cooldev.com/scripts/cooltree. The COOLjsTree has a fairly complete API and certainly looks more professional than my old tree. My old tree only excelled in the speed of opening and closing subtrees, as it was simply a nested unordered list with some CSS and JavaScript.

I also switched to returning instances of Return::Value from some methods. It is nice to have a standardized returnvalue. However I feel somewhat uneasy about the overloaded get_bool() and get_string().

What are the next cool things? Catalyst with HTML::Mason views sound good for the next project. For web testing I'd like to use HTTP::Recorder and WWW::Mechanize, but I think that I can't do without JavaScript support.


Return::Value

rjbs on 2005-07-09T14:26:02

What makes you uncomfortable, specifically? Is it just a vague sense of "this is weird" or something else?

Re:Return::Value

Bernhard on 2005-07-09T16:45:02

Well, it is more the "this is weird" kind of feeling. Overloading is at least in Perl not an everyday language feature. I doubt that most of my colleagues are aware that Perl has overloading, so the code with Return::Value might be neater, but not more intuitive.

Then there is a potential for confusion. A return value can be logically true, but evaluate to a zero length string. Otherwise it can be logically false, but print as an non-empty string.

use strict;
use Return::Value;

print "\nRetval is failure:\n";
my $retval = failure( 'as string' );
print $retval || $retval;

print "\nRetval is success:\n";
my $retval = success( '' );
print $retval || 'no success';
This makes sense when thinking about it, but reading code shouldn't force people to think. On the BioPerl mailing list there was also a discussion about string overloading, http://bioperl.org/pipermail/bioperl-l/2005-June/019215.html