Ovid's JournalOvid's use Perl JournalWhy I Want Smalltalk's Image-Based Systems- June 19, 2008 Or maybe I want Microsoft's Powershell, as I'm guessing I could write hooks into the latter.I'm analyzing our test suite for a serious refactoring and I'm having issues. Here's a symptom of the problem: $ ls tsystemtvaversionsall-versions.xml no-version.xmlillegal_code_and_combination.xml version_with_all_cast_types.xmlillegal_guidance_combination.xml ...http://use.perl.org/~Ovid/journal/36720?from=rss Test::Most now has deferred plans- June 18, 2008 I've just uploaded Test::Most 0.02 to the cpan. Aside from Test::Warn, I've added deferred plans using a patch from barefootcoder++ (Buddy Burden). Example, the following will pass with Test::More 'no_plan': use Test::More 'no_plan';ok 1;exit;ok 2; You can now guarantee that this will fail: use Test::Most 'defer_plan';ok 1;exit;ok 2;all_done; Whee!Of course, if knowing the number of tests is an expensive calculation, you can still specify the plan at the end: use Test::Most 'defer_plan';use...http://use.perl.org/~Ovid/journal/36715?from=rss Aggressive Test Performance Ideas- June 18, 2008 Our test suite now takes half an hour to run, and that's when no one else is here. If I'm fighting them for resources, it's forty minutes. We need to get this back under control.There are several interesting ideas on how to do this. Most of our time is spent in XML::XPath and in the DBIx::Class and how the latter interacts with the database. We need to fix the namespaces in our XML to switch to XML::LibXML, but right now, we have two interesting ideas for the the database problems.The first.http://use.perl.org/~Ovid/journal/36711?from=rss Bash Idiocies- June 17, 2008 It's a long story, but in debugging a bash script, I accidentally did the equivalent of the following: cd () ls -l exit And then I changed into my target directory. Hey, where the hell did my terminal go!!http://use.perl.org/~Ovid/journal/36703?from=rss Anyone use Net::Twitter- June 16, 2008 I'm trying to use Net::Twitter with the following code: !usrbinperl use strict;use warnings; use Net::Twitter; because LoudTwitter requires a userpass ... my %twitter = ( username => 'OvidPerl', password => 'some_password',); my $twitter = Net::Twitter->new(%twitter); my timeline = $twitter->user_timeline;use Data::Dumper;print Dumper(timeline); But I get the following error: JSON text must be an object or array (but found number, string, true, false or...http://use.perl.org/~Ovid/journal/36699?from=rss DateTime::Duration refinement- June 16, 2008 Recently we found we needed to support DateTime::Duration objects a bit more "naturally". Specifically, we needed something like this: my $duration = Our::DateTime::Duration->new( seconds => 23.127 ); laterprint $duration->in_seconds; 23.127 Note that this doesn't work in DateTime::Duration. We've already subclassed it for our own purposes, so it was natural (cough) to add this feature, but even though the interface is simple, the guts are horrifying and confusing. I'm..http://use.perl.org/~Ovid/journal/36696?from=rss XPath Searches In Vim- June 13, 2008 I've just started on this, but I'm getting tired of working with XML documents in vim and having trouble finding what I want. After all, vim's usual regexes don't work terribly well with XML. So I have this program that I have cleverly named "xpath": !usrbinenv perl use strict;use warnings; use XML::XPath;use XML::XPath::XMLParser; my ( $filename, $xpath ) = ARGV; my $xp = XML::XPath->new(filename => $filename ); my $nodeset = $xp->find($xpath); find all paragraphs my...http://use.perl.org/~Ovid/journal/36682?from=rss Junctions, Overloading, and Yesterday's Post- June 13, 2008 The Problem In yesterday's "guess why this works" post, I mentioned the following snippet: foreach my $method (methods) no strict 'refs'; $method = sub shift->$method(_) ; I'm using this to get around documented core behavior, but no one guessed exactly what was going on (I think this is a first). Ben Tilly's Suggestion Both Ben Tilly and Chris Dolan replied with reasonable answers (Chris's answer is close to what I thought is going on, but not quite there). ..http://use.perl.org/~Ovid/journal/36680?from=rss Guess Why This Works- June 12, 2008 After a long, painful session of dodging segfaults, I finally discovered the answer to my problem: foreach my $method (methods) no strict 'refs'; $method = sub shift->$method(_) ; All tests pass and there are no recursion issues. Also, it turns out to be documented core behavior.Just try and guess why I need this.http://use.perl.org/~Ovid/journal/36671?from=rss More On Constraints- June 12, 2008 I was Warnocked in my last post about an approach to constraint programming in Perl 6. This isn't terribly surprising. Constraint programming is one of those areas which is fascinating, but for some reason, doesn't seem to catch on, even though I suspect it could eliminate many bugs in software.If you squint, you could think of a constraint as a data type which is dependent on other variables, but which affects the value of the variable with said type. But what the hell does that mean ...http://use.perl.org/~Ovid/journal/36667?from=rss |