Skip Menu |

This queue is for tickets about the Class-Unload CPAN distribution.

Report information
The Basics
Id: 88888
Status: rejected
Priority: 0/
Queue: Class-Unload

People
Owner: Nobody in particular
Requestors: dmuey [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Not fully "clearing out its symbol table"
use Class:: Unload; say Class:: Unload;->VERSION; # v0.07 say $]; # 5.016000 use Cwd; say Cwd->VERSION; # gives the version say $Cwd::VERSION; # gives the version say Cwd::cwd(); # gives the current dir Class::Unload->unload("Cwd"); say Cwd->VERSION; # undef, i.e. was unloaded say $Cwd::VERSION; # still gives the version! i.e. not unloaded say Cwd::cwd(); # still gives the current dir! i.e. not unloaded
CC: undisclosed-recipients:;
Subject: Re: [rt.cpan.org #88888] Not fully "clearing out its symbol table"
Date: Mon, 23 Sep 2013 21:58:50 +0200
To: bug-Class-Unload [...] rt.cpan.org
From: ilmari [...] ilmari.org (Dagfinn Ilmari Mannsåker)
"Daniel Muey via RT" <bug-Class-Unload@rt.cpan.org> writes: Show quoted text
> Class::Unload->unload("Cwd"); > say Cwd->VERSION; # undef, i.e. was unloaded
This is because UNIVERSAL::VERSION() looks up the packages $VERSION variable at runtime using hv_fetchs(pkg, "VERSION", FALSE). Show quoted text
> say $Cwd::VERSION; # still gives the version! i.e. not unloaded > say Cwd::cwd(); # still gives the current dir! i.e. not unloaded
These, on the other hand, were bound at compile time, and don't go through the symbol table at runtime. This is how e.g. namespace::clean can remove imported functions from the symbol table at the end of compilation, so they can't be called as methods. If you wrap the before-unload tests, the unload call and the after-unload tests in separate BEGIN blocks, you'll see the results you're expecting. -- "A disappointingly low fraction of the human race is, at any given time, on fire." - Stig Sandbeck Mathisen
thanks for the info