Click here to get back home

same namespace as main

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
same namespace as main knut 06-29-2005
Posted by knut on June 29, 2005, 2:56 am
Please log in for more thread options


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();



Posted by Sherm Pendley on June 29, 2005, 8:15 am
Please log in for more thread options



> 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


Similar ThreadsPosted
SGF namespace August 1, 2005, 5:18 pm
New Namespace? January 27, 2007, 3:00 am
new framework, namespace help please! September 12, 2005, 7:15 am
TL1 module namespace May 12, 2005, 1:13 pm
A module looking for a namespace March 4, 2005, 11:15 pm
New module namespace May 17, 2006, 8:38 pm
Namespace request: SPC? March 2, 2007, 10:58 am
Module namespace query July 23, 2004, 12:36 pm
Namespace -- Net::Telnet::Cisco::IOS November 24, 2005, 1:01 pm
namespace declarations in LibXML April 15, 2006, 12:48 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap