same namespace as main

same namespace as main

am 29.06.2005 11:56:45 von knut

Hi,

I want to "include" some code in my main. this code should access
variables and functions of the main. can I load code in the same
namespace as the loader is?

---
main.pl: # or any including module
---

my $module_name = "path/name.pl";
my $var1;
my $obj1 = new Object1;

sub func1 {
...
}

....

do/require? "$module_name"; # dynamicly include some code


---
path/name.pl:
---
package name; # ??

my $var2;
....
$var1 = some_calculation(); # access variables from main/parent
module
func1($var2);
$obj1->method();

Re: same namespace as main

am 29.06.2005 14:15:10 von Sherm Pendley

"knut" writes:

> I want to "include" some code in my main. this code should access
> variables and functions of the main. can I load code in the same
> namespace as the loader is?

Have a look at:
perldoc Exporter

sherm--

--
Due to the amount of unreadable gibberish being posted from Google Groups,
I seldom read messages posted from there.

Cocoa/Perl: http://camelbones.sf.net Hire Me: http://www.dot-app.org