Joe Schaefer wrote:
Geoffrey Young <[EMAIL PROTECTED]> writes:

[...]


what if you want to unload just Foo and not Foo::Bar?  CGI and Digest
come to mind...


It's really hard to make module unloading work 100% reliably because

-1) Perl doesn't keep track of all the necessary bits to allow this cleanly ;-)

  0) {modules} != {packages} so reloading a module will influence
     every package it touches (even the ones you forgot to delete),

Yes, in the case of a module with many package definitions, you are in trouble

1) perl sometimes does compile-time tricks to avoid symbol lookups,

Yup, also true.

2) symbols are occasionally aliased into other namespaces (eg Exporter), and those aliases won't get rebound once the new symbol definitions
are loaded.

Well, partially true. It just means the existing aliases will be pointing to the _old_ values for that module. Kinda similar to an external module taking a ref to a sub in the package.

... I'm sure there's a whole bunch more issues that I'm overlooking (ithreads?) ...

Simply put, Apache::Reload and friends are trying to wipe out a namespace even though Perl doesn't quite support that. It's doing it's best and I am not sure it could ever do a 100% clean job (thinking optimizer, for instance).

There's always Symbol::delete_package, but it looks pretty
pedestrian when compared to Philippe's patch.  I certainly
don't see any harm done by including it in mp2, since it
may work just fine for the majority of users.

-- -------------------------------------------------------------------------------- Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5 http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5

Attachment: signature.asc
Description: OpenPGP digital signature



Reply via email to