Skip Menu |

This queue is for tickets about the Module-Runtime CPAN distribution.

Report information
The Basics
Id: 19937
Status: rejected
Priority: 0/
Queue: Module-Runtime

People
Owner: ZEFRAM [...] cpan.org
Requestors: rrwo [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 0.000
  • 0.001
  • 0.002
Fixed in: (no value)



Subject: Add support for "no" call to unimport function in module
You should add support for the "no" interface, e.g. no warnings; which calls the unimport function in a module.
Subject: Re: [rt.cpan.org #19937] Add support for "no" call to unimport function in module
Date: Fri, 16 Jun 2006 15:01:21 +0100
To: Guest via RT <bug-Module-Runtime [...] rt.cpan.org>
From: Zefram <zefram [...] fysh.org>
RRWO wrote: Show quoted text
>You should add support for the "no" interface, >which calls the unimport function in a module.
Presumably this request is based on the understanding that the module already supports the "use"/"import" interface. Actually it supports neither: it never calls either "import" or "unimport" methods. The use_module() function only does loading and version checking, not importation. For these parts of the process "use" and "no" behave equivalently. You can load a class perfectly well with "no", which I did to save a couple of characters in the program at <http://www.fysh.org/~zefram/eht/eht>. The way to do importation at runtime is to explicitly call the package methods: use_module("Acme::Innuendo", 0.02)->import; use_module("warnings")->unimport; I'm having difficulty imagining why you'd need to import by this mechanism, though. The only situation I can come up with is in a BEGIN block, if you know what functions you want to import but need code to decide which module to import them from. What are you actually doing? -zefram
No meaningful bug reported.
On 2006-06-16 07:01:58, zefram@fysh.org wrote: Show quoted text
> RRWO wrote:
> >You should add support for the "no" interface, > >which calls the unimport function in a module.
> > Presumably this request is based on the understanding that the module > already supports the "use"/"import" interface. Actually it supports > neither: it never calls either "import" or "unimport" methods.
I think the requestor was asking for Module::Runtime itself to implement an unimport method, which is called (when it exists) by "no Module::Runtime". However, not even Exporter.pm implments an 'unimport' yet, so this convention is not terribly well-established. Additionally, an easier way of cleaning one's namespace, rather than calling 'no $module' for every module 'used' earlier, is to simply use namespace::clean or namespace::autoclean.