On Mar 25, 2009, at 1:16 AM, Chas. Owens wrote:

You need to add the variables you want exported to either @EXPORT (the
mandatory list of things to export) or @EXPORT_OK (this list of things
to export on demand).  The biggest complication is your desire to pass
in a variable.  This means that we cannot use the import function that
Exporter creates for us (since it doesn't know how to use $g_project).
So, we have to write our own import function and call export_to_level
ourselves.

Thanks, again, for your help - including the many other tips you've interspersed. I've successfully incorporated this into my "real" code and it's working.

I'm sure when I get my head around modules a bit better, I'll know how to design toward what they're designed to do most naturally, instead of having to override built-in behaviors, etc. I think one thing that's hard to grasp is the intermingling of code execution with code compilation, where BEGIN blocks and 'use' are concerned. But I think that'll come.


#This is where we should put the global variables, they need to
#be package variables, so they are declared with our instead of
#my
our $g_database_path;


This one baffles me. I still have to explicitly export $g_database_path by putting it into @EXPORT - what is 'our' doing that 'my' doesn't?


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to