Thursday, March 16, 2006

Testing if a Perl script compiles - compile_ok

A co-worker and I were pair programming a test suite the other day, and needed to test if a Perl script compiles - not a library or module but an executeable script, so the typical:
    require_ok()
use_ok()
functions provided by Test::More don't do exactly what we wanted.

The short story is that we ended up doing something like this:
  eval {
$output = `perl -c $script 2>&1`;
chomp $output;
};
is($output, "$script syntax OK", "$script compiles");
We later looked for a more general, better solution, and a colleague posted on the perl-qa mailing list, but the bottom line is that a more elegant solution still involves executing a new perl interpreter, but in a platform-independent way (perhaps using IPC::Open3 or something.) It's also likely that a better test is to ignore the output altogether and just check the return code from the compile process (the call to perl -c.)

March 18, 2006 update: Jeff Thalhammer found that a colleague Pierre Denis provides a syntax_ok method in Test::Strict that does what we want.
More update - I was prodded by Randall Schwartz to post why you should be careful when "only" compiling Perl code - see BEGIN Blocks Considered Harmful.
Tags: ,

Swimming Snake Robot

OK, ready to be creeped-out and fascinated?

http://www.hackaday.com/entry/1234000957073583/

Tuesday, February 21, 2006

RFC: Mozilla Architecture Changes

Dave Liebreich is looking for people to participate in conversations about proposed major changes in the architecture of Mozilla.

Dave provided the following URLs for current discussions about the issues (garbage collection approach and using exceptions) and asks that interested people jump in and participate:
Mozilla Wiki
Mozillazine.org
Benjamin Smedbergs on Exceptions
Benjamin Smedbergs on Garbage Collection
Tags: ,

Should Arab Media Take Lessons from the West?

An excellent debate among journalists from and working in the Arab world, debating the motion "This house believes that the Arab media need no lessons in journalism from the West."

Saturday, February 18, 2006

Bunchball - put interactive stuff in your blog

http://www.bunchball.com/

The idea is you put a code snippet in your web page, blog etc. and then you can upload photos etc. to bunchballs servers and they show up in your page. Also does games, and various other interactive thingies.

Friday, February 17, 2006

Perl IDE Demonstration and Comparison

The San Francisco Perl Mongers are sponsoring a demo of three Perl IDE's on Tuesday, February 28, 2006:

When & Where:
When: Tuesday, February 28, 2006, 8:00 p.m.
Where: Perpetual Entertainment, Fifth floor;
149 New Montgomery Street, San Francisco, CA
RSVP: qw@sf.pm.org - please let us know if you are attending, and if you want thai food, bring some $$

If you would like to attend, please contact Quinn Weaver at the address above - and bring cash if you want Thai food!