develooper Front page | perl.perl5.porters | Postings from October 2003

require UNIVERSAL;

Thread Next
From:
Slaven Rezic
Date:
October 6, 2003 08:16
Subject:
require UNIVERSAL;
Message ID:
1065452726.12326@devpc01.iconmobile.de
The explicit usage/requirement of UNIVERSAL.pm seems to break things:

$ perl -Mless=time -e1
(no errors)

$ perl -MUNIVERSAL -Mless=time -e1
"time" is not exported by the less module
Can't continue after import errors at -e line 0
BEGIN failed--compilation aborted.

I see the following comment and code in UNIVERSAL.pm:

# UNIVERSAL should not contain any extra subs/methods beyond those
# that it exists to define. The use of Exporter below is a historical
# accident that can't be fixed without breaking code.  Note that we
# *don't* set @ISA here, don't want all classes/objects inheriting from
# Exporter.  It's bad enough that all classes have a import() method
# whenever UNIVERSAL.pm is loaded.
require Exporter;
*import = \&Exporter::import;

Can anybody remember the requirement for defining the import alias?
Can it be removed? If not, then the documentation of UNIVERSAL.pm should
be changed and it should say in big letters to not use or require
UNIVERSAL.

Regards,
    Slaven

-- 
Slaven Rezic - slaven <at> rezic <dot> de

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About