in reply to scoped namespace?

use Symbol qw( delete_package ); delete_package( $foo_name_space );

Update: (As webfiend asked for elaboration...) Symbol is a module. It comes with perl. Read perldoc Symbol for more information. Of course, this doesn't have anything to do with "scoping" of any kind... but it should get the job done. ;-)

-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re: Re: scoped namespace?
by Anonymous Monk on Jun 17, 2003 at 00:37 UTC

    Thanks. This looks like it's exactly what I was looking for. Is this lexically scoped in such a way that if it happens in a method, the foo_name_space that is require'd in can't be seen by another mod_perl process?

    Also, to clarify, here is a small example using Symbol as suggested:

    #!/usr/bin/perl use strict; use warnings; use Symbol qw( delete_package ); + eval { do './foo_name_space.dat'; print "within eval: ",$foo_name_space::data,"\n" if $foo_name_space: +:data; delete_package('foo_name_space'); }; if( $@ ){ print "Oops [$!]","\n"; } if($foo_name_space::data){ print "outside eval: ",$foo_name_space::data,"\n" }else{ print "no such namespace\n"; }