develooper Front page | perl.perl5.porters | Postings from August 2001

Re: [ID 20010629.003] Symbol::delete_package bug

Thread Previous | Thread Next
From:
Chris Nandor
Date:
August 1, 2001 05:27
Subject:
Re: [ID 20010629.003] Symbol::delete_package bug
Message ID:
pudge-AC723A.08275601082001@onion.valueclick.com
In article <20010730222948.C10227@chaos.wustl.edu>,
 jhi@iki.fi (Jarkko Hietaniemi) wrote:

> On Fri, Jun 29, 2001 at 04:30:14PM -0400, Jörg Ziefle wrote:
> > This is a bug report for perl from gt4556a@gatech.edu,
> > generated with the help of perlbug 1.26 running under perl 5.00503.
> > 
> > 
> > -----------------------------------------------------------------
> > [Please enter your report here]
> > 
> > Problem: Symbol.pm 's delete_package function doesn't delete the package 
> > from
> > %INC, so when require()ing the package again, it's still found in %INC and 
> > not
> > reloaded.
> > 
> > Fix: making delete_package delete the package from %INC as well or 
> > documenting
> > this so the coder is aware of it and can manually remove the package from 
> > %INC.
> > 
> > Sample code and a patch on request.
> 
> Consider this a request.

Personally, I would prefer a doc patch.  When I've used delete_package 
before, I've not wanted anything deleted from %INC.  At most, make the 
behavior optional.  It'd be hard to write code for it anyway; what if I 
want to delete the package Tie::RefHash::Nestable?  There's no 
accompanying file for that.  Or, conversely, if I delete the package 
(and file from %INC) for Tie::RefHash, the package 
Tie::RefHash::Nestable will still be around.

delete_package should not be used to delete a module or library, and I 
don't think we should conflate the two.  It is there to just clear out a 
namespace, which could be used in conjunction with delete'ing from %INC.  
Perhaps there's room for someone to write an "unuse" pragma?  It'd be 
pretty hairy, I think, to completely back out of a "use".  How does Perl 
know which symbols have been exported to which packages?  Which packages 
are in which files?  It seems like someone wants to do with 
delete_package more than it is designed to do, and even doing all that 
is desired would be difficult anyway.

-- 
Chris Nandor                      pudge@pobox.com    http://pudge.net/
Open Source Development Network    pudge@osdn.com     http://osdn.com/

Thread Previous | 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