Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: scoped namespace?

by sauoq (Abbot)
on Jun 16, 2003 at 23:36 UTC ( [id://266337]=note: print w/replies, xml ) Need Help??


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"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://266337]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-18 01:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found