develooper Front page | perl.perl5.porters | Postings from September 2016

Re: I'd like to get rid of "use UNIVERSAL;"

Thread Previous | Thread Next
David Cantrell
September 27, 2016 12:17
Re: I'd like to get rid of "use UNIVERSAL;"
Message ID:
On Tue, Sep 27, 2016 at 12:39:58PM +0100, Dagfinn Ilmari Manns?ker wrote:
> David Cantrell <> writes:
> > On Mon, Sep 26, 2016 at 10:32:11PM +0200, ?var Arnfj?r? Bjarmason wrote:
> >> But technically this does break backwards compatibility without a
> >> deprecation cycle. Because "use UNIVERSAL;" isn't an error today, and
> >> some code on the CPAN redundantly uses that.
> > You'll also break this:
> >   use UNIVERSAL;
> >   ...
> >   if(UNIVERSAL::isa($foo, 'Some::Class')) { ...
> This continues to "work"

The proposal is to make it not work.

>                          and never required 'use UNIVERSAL', since the
> function is provided by universal.c, not

I doubt that many people are aware of that, and that even fewer of them
understand what that means.

Anyway, the string 'use UNIVERAL;' appears in 74 dists on the CPAN
according to At least some of them are completely
redundant in that the file that includes it doesn't also include a call
to UNIVERSAL::isa or its friends (presumably it used to in an earlier
version and the 'use' hasn't been deleted), but not all are.

David Cantrell | A machine for turning tea into grumpiness

    Wow, my first sigquoting! I feel so special now!
        -- Dan Sugalski

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About