same namespace as main
am 29.06.2005 11:56:45 von knutHi,
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();