Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.
Oops That namespace is taken. I'll think again. Suggestions welcome.
Quite often I find myself needing a simple check to see if a sub has already been called. This happens all the time and I hate coding this.
use Sub::Called 'already_called', 'not_called';
sub user {
unless (already_called) { # only gets called once
My::Fixtures::Users->load;
}
...
}
sub schema {
if ( not_called ) {
# setup schema
}
else {
return $schema;
}
}
Yeah, it was only five minutes to write and it's a minor, minor nit, but I hopefully won't have to worry about it again. It should be on the CPAN soon.
It checks the package and subroutine to determine if it's been called yet.
It's possibly my most trivial module. Flame away!
Memoize? (Score:2)
This gives me an idea for the Ruby memoize library, actually...
Re: (Score:2)
I don't want to necessarily memoize these functions, so hooking into that doesn't seem right (though to be fair, it didn't occur to me, either).
I can add this functionality to my module (Score:1)
I could add the functionality you mentioned to my module...
Cheers, Renee
Re: (Score:2)
If you want to do that, it would be great and I can just delete mine. Thanks :)