develooper Front page | perl.perl5.porters | Postings from March 2000

[ID 20000324.029] `unimport' is not special the way `import' is

Thread Next
March 24, 2000 07:24
[ID 20000324.029] `unimport' is not special the way `import' is
Message ID:
This is a bug report for perl from,
generated with the help of perlbug 1.26 running under perl 5.00503.

[Please enter your report here]

Down in gv_fetchmethod_autoload (gv.c:375) is a special-case that says
that it is OK to call an `import' method even if none is defined,
which would normally be a fatal run-time error.  This is so that you
can still say `use module' even if `module' does not provide an
`import' subroutine.

There is no analogous exception for `unimport', which means that if
you try to do `no module', and the module has no `unimport' function,
your program aborts.  For example:

        plover% echo '1;' >
        plover% perl -e 'use Foo';
        plover% perl -e 'no Foo';
        Can't locate object method "unimport" via package "Foo" at -e line 1.
        BEGIN failed--compilation aborted at -e line 1.

I first noticed this in connection with

        perl -e 'no diagnostics'

which dies.  

It's easy to prepare a patch for this, but I wasn't sure it was
advisable.  Also, I wasn't sure where to put the test.

[Please do not change anything below this line]

Site configuration information for perl 5.00503:

Configured by mjd at Sun Jan 23 14:15:22 EST 2000.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
    osname=linux, osvers=2.2.12, archname=i586-linux
    uname='linux plover 2.2.12 #10 mon nov 1 17:02:09 est 1999 i586 unknown '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
    cc='cc', optimize='-O2', gccversion=egcs-2.90.29 980515 (egcs-1.0.3 release)
    cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /shlib /lib /usr/lib
    libs=-lndbm -lgdbm -ldbm -ldb -ldl -lm -lc
    libc=/lib/, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:

@INC for perl 5.00503:

Environment for perl 5.00503:
    LANG (unset)
    LANGUAGE (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)

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