WWW::UsePerl::Journal

Russell Matbouli russell-belfast-pm at futureless.org
Sun Jan 27 15:55:47 CST 2002


On Sun, Jan 27, 2002 at 07:37:39PM +0000, Tony Bowden wrote:
> Firstly, you don't really need tests like:

I subtly reused [0] the tests that Andrew created for Text::Echelon
which did this sort of thing.

> The third test implies the first 2 anyway ... if it's 1413, then it
> can't be undef or the empty string ...

Yes. I'm going to rewrite the tests now. I might change the interfaces
too, since it is still only 0.01.

> Then 
>   my @entries = $j->getEntryList($username);
>   isnt($#entries, 0, "getEntryList got more than one entry");
> 
> isn't doing what you think. 

Why doesn't that surprise me :)

> If @entries is empty, as it is when I run the test, $#entries is -1.
> You can just use:
> 
>   isnt (scalar @entries, 0, "getEntryList got more than one entry");

Good. I'll do that. I'll read the perldoc too sometime...

> It seems that this array is empty because your pattern match is wrong
> when scanning the list of all journal entries. I think the journal urls
> have changed: they're now like
>   http://use.perl.org/~russell/journal/2340/

Ah, I didn't know of this interface before. The old one still seems to
work though, so the test should pass, when rewritten at least...

> Test::More uses Test::Builder. You can blame Schwern on the confusing
> error messages ;)

Schwern... Surely none of his code would throw crazy error messages!

> As regards the module itself - every 'method' takes an initial argument
> of the username ... so you may wish to consider making it part of the
> constructor instead...

This would let me cache the output of, eg, getUID too. How excellent.
Now I remember why OO is useful...

> The guts of this would be something like:

Great. I'm going to give it an overhaul before I go to bed tonight. 0.02
will also include writing ability, thanks to an Iain Truskett, who
mailed me the necessary code shortly after release. Thanks Iain!

Cheers for the code review, I'm hopefully learning something from all
this awful code I'm outputting...

[0] Brainlessly. Changed what they were pointing at, mostly...
-- 
Russell Matbouli       |  "People should treat their emails like seaside post
russell at futureless.org |  cards; that is to say put anything you like on them
PGP KeyID: 0x3CA84CF4  |  but don't be surprised if someone else reads them."
                       |   - Neil MacCormick, EU parliament Echelon committee
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://mail.pm.org/archives/belfast-pm/attachments/20020127/81407160/attachment.bin


More information about the Belfast-pm mailing list