[CDBI] Re: how can I make data returned from CDBI methods be considered untainted?

Michael G Schwern schwern at pobox.com
Tue Mar 6 03:35:51 GMT 2007


Edward J. Sabol wrote:
> Michael Schwern wrote:
>> Argh! That's a private method (or at least protected)!
> 
> I prefer the term "undocumented." :-)

That's three times the reason not to use it!

Whether its protected or private, you reached for a shotgun when bug spray 
will do.


> Seriously, if I may be so presumptuous
> as to debate the point with the original author of both Ima::DBI and
> Class::DBI, I would say it's protected, not private. Based on some posts by
> Tony on the old CDBI mailing list, my interpretation of the Class::DBI API,
> which is certainly not unimpeachable, is that only methods that start with
> double underscores are strictly forbidden (private). Methods with single
> underscores are "mostly safe" (protected, sort of), though not absolutely
> guaranteed to remain unchanged from version to version, of course.

I'm not willing to comment on the naming conventions, but if its 
undocumented its undocumented and can change at any time.  Without a 
documented API you override at your own risk.


> _default_attributes() is inherited from Ima::DBI though, as I'm sure you
> know, and then overriden in Class::DBI, which then calls the same method in
> its superclass (Ima::DBI); it's very clearly not going anywhere.

CDBI and Ima::DBI have a "special" relationship that's probably illegal in 
most US states.  They're maintained by the same author and often released at 
the same time.  Therefore, its not exactly the model for encapsulation.

I myself am trying to eliminate such coupling from my own modules.  I figure 
whatever guts I find myself poking at will be useful to someone else.  I've 
mostly torn Test::More and Test::Builder's unseemly embrace apart.



More information about the ClassDBI mailing list