Calling UNIVERSAL::can() as a function is allowed. (was: [OT] best way to determine existence of a function in a package)

Matt S Trout dbix-class at trout.me.uk
Wed Nov 21 22:17:51 GMT 2007


On Wed, Nov 21, 2007 at 07:17:07PM +0000, Andy Wardley wrote:
> I've been personally bitten by the OO dogma when I started getting bug
> reports about TT not working with one of the popular database ORM packages
> (Class::DBI?  DBIx::Class?  Can't remember off hand).  It turns out that
> this package had recently started using the UNIVERSAL::can from CPAN which
> advertises itself as a "Hack around people calling UNIVERSAL::can() as a
> function".

It's not us, I consider the UNIVERSAL::can and ::isa modules to be hateful
(and generally where possible eliminate any UNIVERSAL::* modules from
my dep tree on the grounds that while the guy writing the currently executing
program is perfectly entitled to change the interpreter's behaviour at his
whim, it's impolite of me to do it in a manner that he didn't explicitly
ask for :)

In an OO paradigm things using UNIVERSAL::can as a function in such a way as
to break the overloading I'm doing is a bug. Thus it should be fixed.

I don't want my interpreter monkeypatched to work around other people's bugs.
That was lies windows.

-- 
      Matt S Trout       Catalyst and DBIx::Class consulting and support -
   Technical Director      http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Christmas fun in collectable card game form -
                           http://www.shadowcat.co.uk/resources/2007_trading/


More information about the london.pm mailing list