* On Mon, Jul 14 2008, Paul LeoNerd Evans wrote:
> On Tue, 15 Jul 2008 06:11:25 +1000
> "Ivan Wills" <[EMAIL PROTECTED]> wrote:
>
>> If Paul "LeoNerd" Evens doesn't want to create the module Devel::Refcount
>> along with Test::Refcount I would be happy to do it my self.
>
> Well, it's not that I don't want to as such.. I'm just not sure it's
> really justified.
>
> It's kindof a personal thing, but I have a disliking for the mass
> accumulation of really small "one-liner" modules around the place. 

I like these.  It's as important to reuse simple things as it is to
reuse complicated things.

> Would anyone consider
>
>   package String::CaseInsensitive;
>   sub casecmp { lc $_[0] cmp lc $_[1] }
>   1;
>
> as a module, for example?

No, but that's because "lc" is the hard part, not the call to cmp.  If
Perl didn't have "lc" built in, you'd bet I'd want the "lc" function
from a module, rather than the "simple" (but wrong) tr/[A-Z]/[a-z]/.

> When the module starts to get this small, I begin to wonder if it's more
> of a documentation issue. Perhaps somewhere in the documentation about
> objects and reference counts:
>
>   The reference count of an object can be obtained by
>
>     use B qw( svref_2object );
>
>     my $count = svref_2object($ref)->REFCNT;

Considering B is core, there is probably no need for a module to do
this.  But, does this always return correct results?  Does the
svref_2object call affect the REFCNT?  I am too lazy to check, but these
are nice questions for the documentation to answer.  If svref_2object
affects its argument, then it's probably best to write a module that
compensates for this behavior.

Regards,
Jonathan Rockway

-- 
print just => another => perl => hacker => if $,=$"

Reply via email to