Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

heusserm (4461)

  (email not shown publicly)
AOL IM: MatthewHeusser (Add Buddy, Send Message)

Matt Heusser is JAPH and an XP-Er []. (The Methodology, not the Operating System.) Right now, he's doing a lot of Test Driven Development in Perl.

Journal of heusserm (4461)

Sunday December 28, 2003
09:15 PM


Re: STAREAST, May 17-21 2004, The Rosen Centre Hotel, Orlando, FL

We are pleased to welcome you as a Track Speaker at STAREAST 2004 ...

This begins my letter of acceptance as a speaker at Star East 2004. I'll be speaking on Test Driven Development in Perl. Obviously, this would never have happened without Scwhern, Chromatic, Lester, Scwartz, Wall, and Kent Beck.

Anyone want to peer review a 1-hour presentation?

Monday December 22, 2003
01:45 PM

So, I've got some code that uses

Now and again, I have to transfer really really big files. The whole system is automated, but it hangs and dies on a call to $ftp->put($filename).

So, the app dies, the sysadmin re-starts it, and it starts over again, transmitting the same file, hangs and dies. Never gets to the rest of the files, some of whom go to FTP sites that actually, you know, work.

I'm thinking of refactoring the code so that it just reports error instead of die-ing. Then it can process the ones that might work, and then come back and try again with the big file that only works rarely.

To do so, I'm planning on wrapping an eval block around the offensive code, and checking $@ to see if the call 'dies.'

Does this sound like a good approach?


Thursday December 04, 2003
11:35 AM

Generic Unit Tests

Someone on JoelonSoftware wanted to figure out how to do automated unit tests in TCL, so I wrote up this post:

Mike Scwern wrote test::More for Perl as well as test::Tutorial.

Basically, I'd suggest making a simple library with functions like this:

sub tests(int);
sub eq(string, int, int);
sub eq(string, bool, bool);
sub eq(string, double, double);
sub eq(string, string, string);
sub ok(string, bool);

The psuedo code looks something like this:

GLOBAL iTestNum int;
sub tests(i int)
    printf("1..%d\n", i);
    iTestNum = 1;

sub ok(s string, b bool)
    if (b)
        print("ok %d - %s\n", iTestNum, s);
        print("not ok %d - %s\n", iTestNum, s);

sub eq(s string, i int, i2 int)
    if (i==i2)
        print("ok %d - %s\n", iTestNum, s);
        print("not ok %d - %s\nGot %d\nExpected %d\n",
                        iTestNum, s, i, i2);
} //---End Psuedo Code

So your output to STDIO looks like this:

ok 1 - Foo with valid input
ok 2 - Foo with invalid group number
ok 3 - Error Message for invalid group number
not ok 4 - Foo with invalid date
not ok 5 - Error Message for invalid date
    Expected - "Date 10/35/2003 is not a valid date"
    Got - ""

Obviously, your function is something like:

func foo(iGroupNum int, sDate string) returns BOOL;

--All this is pseduo code you can write up in any langauge.

If you write it correctly, you can pump it through Test::Harness or Prove automatically.

That's the 5 minute version, anyway. You can write test harnesses in any language. (If you die after test 3 because of an unhandled exception, you know you SHOULD have had 5 tests because of the 1..5, so that too is a test.)

Thoughts? I think there's some interesting potential stuff about a "Generic Unit Test Framework", but it needs more work ...

Tuesday December 02, 2003
08:26 AM

The obligatory 'story card picture'

Some day, I'm going to write some articles on my XP experiences. For the time being, all I've got is this picture.
Tuesday November 25, 2003
10:33 AM

Structured Exception Handling?

So, I just walked a co-worker through how to use eval/die to catch errors before they propigate.

(He wanted to use a signal handler to see if a system() call was running rogue. Pretty cool stuff.)

Does that mean I can put "structured exception handling" on my resume? :-)
Thursday November 20, 2003
08:20 AM

On Perl 6

I must admit, I thought Perl 5 was "good enough" and didn't really want to spend the time to figure out perl 6.

Then I saw Matt Diephouse's Presentation on Perl 6

All the pure OO guys who want intutive OO syntax, run time type information, templating, strict type checking and structured exception handling? It's in there.

All the perl purists who want nothing to do with types, exception handling or required OO syntax? ... well, it's in there.

Want a "Switch" Statement? You can have something better: given/when.

Want typed paramteres? It's in there. Don't want typed paramteres? It's in there.

Simply put, Perl 6 provides the features of C++ or Java that OO people "need", but doesn't require them.

Of course, some lady with a resturant has been saying that since the perl 6 project started, but it took more than 5 minutes for me to "get it".

IMHO, the biggest problem with perl 6 is marketing. Instead of calling it "P6/P" I think it should be called "P6EE." And the parrot runtime should have a fancy name like "The e-CLR" (The Extensible Common Language Runtime). With a few more bells and whistles, we might even be able to the get the pointy-haired-boss crowd ...

Sadly, Unlike Dr. Maher, that forces me to ask the question "Hey, are we really sure we want the pointed haired boss crowd?"

That one is going to take some thinking.
Wednesday November 19, 2003
07:59 AM

Time to refactor my website

I'm afraid my website is slowly becoming a big ball of mud. (It "Smells Bad")

Basically, it was organized as three blogs in three vaguely-overlapping subject areas, but then I got a blog on ... so it's four. Sorta.

Here's the site

Here's my thoughts:

Reorganize the site:

(A) Leadership-Ish Stuff
(B) So you're thinking about an Advanced Degree in CS? PPTs, papers, and programs. (Think of it as "OpenCourseWare Lite")
(C) Faith
(D) Software Development
(E) Quality Through Agile Methods
(F) Perl
(G) Professionalism in software development

I'm thinking of marrying D&E or even D, E, and F. Maybe G as well. The span of control, as it stands now, is too big.
Also, the terms need to be shorter.

Tuesday November 04, 2003
09:27 AM

lil' vi help ...

I've got a program that looks something like this:

#Begin code
$sth->bind_param(1, 'blahblah');
$sth->bind_param(2, $somevar);
#End Code

I want to change it to this:

#Begin code
$sth->bind_param(1, $somevar);
$sth->bind_param(2, 'blahblah');
#End Code

Here's how I would do it in VI:

Go to the 1. Type 'I' (Insert Mode), change it to 2. Go to the 2, change it to 1. Type 'ESC'

Do to the first line. Press DD (Delete). Arrow down. Press P (Paste). Arrow up, and DD the blank line inserted. Arrow down, press I (Insert), backspace, hit return, then fix the indenting on the next line.

I'm 100% convinced this is a silly, inefficient way to type. Yes, it beats the heck out of some GUI Windows-like text editor, but still, it should be faster. I just don't know enought about VI (or vim) yet.

Ideas are welcome.

Monday October 27, 2003
07:36 AM

Ken Williams

"Some people sing, some dance, some write. I don’t do any of those things. Mostly I just write code, and build great product. It’s what I’m good at. If I had to push it just a bit harder, I also have a talent (which is unused at the present time) for motivating creative people to do great product. But that’s about it ..."

Ken Williams, former CEO and Co-Founder of Sierra Games, the people that brought you King's Quest. I would disagree; search the web for non-for-any-revenue-at-all organizations making fan "quest" games to continue the sierra tradition and you'll be amazed. He still is motivating creative people to do great product.

Insert cheesy line about how Sierra made we want to write code here. :-)
Friday October 24, 2003
01:43 PM

Those LISP Guys ...

After reading some comments, I did some more research. It seems the author of the paper "Worse is Better" also wrote an article called Lessons of the science of nothing at all

XP, Agile, Open Source. heh. Who'd have thought?