February 2nd, 2005

diesel, learning, evil, sweeti


... which had a tiny but significant bug to do with running under tests.

Richard Clamp diagnosed a problem as being due to the fact that we exclude anything not from blib if there was blib.pm is in %INC.

    my @SEARCHDIR = exists $INC{"blib.pm"} ? grep {/blib/} @INC : @INC;

Of course if the module being tested used another module that used Module::Pluggable then the second module would fail because none of its plugins would work either..

So, fixed it by checking to see if the caller had (^|/)blib/ in their filename.

    my $filename = (caller)[1];
    my @SEARCHDIR = exists $INC{"blib.pm"} && $filename =~ m!(^|/)blib/! ? 
                    grep {/blib/} @INC : @INC;

Which seems to fix everything.

diesel, learning, evil, sweeti

Bot::Infobot - an update

So Tom and I disagreed on the way that infobot factoids should be stored and then presented - I prefer a random factoid out a possible list, he prefers a massive concatenation of all of them (providing it's less than the irc line limit, obviously) so that


    <tom> bot, foo?
    <bot> tom - foo is bar or quux or quirka


    <muttley> bot, foo?
    <bot> muttley - foo is bar
    <muttley> bot, foo?
    <bot> muttley - foo is quux
    <muttley> bot, foo?
    <bot> muttley - foo is quirka

after a bit of back and forth I figured out a way to have both and went off to implement it/ But the Infobot.pm code is icky so, being a good little coder I wanted to implement tests first. Which is dull. And so therefore I haven't done it yet. Bad me :(