LogoopenSUSE Build Service > Projects
Sign Up | Log In

Hack around people calling UNIVERSAL::can() as a function

The UNIVERSAL class provides a few default methods so that all objects can use
them. Object orientation allows programmers to override these methods in
subclasses to provide more specific and appropriate behavior.

Some authors call methods in the UNIVERSAL class on potential invocants as
functions, bypassing any possible overriding. This is wrong and you should not
do it. Unfortunately, not everyone heeds this warning and their bad code can
break your good code.

This module replaces UNIVERSAL::can() with a method that checks to see if the
first argument is a valid invocant has its own can() method. If so, it gives a
warning and calls the overridden method, working around buggy code. Otherwise,
everything works as you might expect.

Source Files (show merged sources derived from linked package)

Filename Size Changed Actions
UNIVERSAL-can-1.16.tar.gz 7.5 KB Download File
UNIVERSAL-can-1.20110617.tar.gz 14 KB Download File
perl-UNIVERSAL-can.changes 303 Bytes Download File
perl-UNIVERSAL-can.spec 1.86 KB Download File

Comments for home:NoseyNick (0)

Login required, please login or signup in order to comment