I see. Thanks Shawn. Since we are at it, would you mind explaining a little bit
about the significance of "our" keyword. I have never understood it properly.
Most books that I referred to say that it's a "lexically-scoped global
variable". What does that mean? I understand global variables to be the ones
which are accessible to all perl program units (modules, packages or scripts).
But then, what is so lexically-scoped about it? What do the perl compiler and
opcode interpreter do when encounter a variable name prefixed by "our"? 

I do not mean to ask you so many questions at once. It is just to prove how
confused I am about this keyword!

Thanks.

Vishal
 

Quoting Shawn Corey <[EMAIL PROTECTED]>:

> 
> [EMAIL PROTECTED] wrote:
> > Thanks Shawn. But, in this case, how would we send a parameter to the
> module
> > from the calling script. The module can see the name of the calling script,
> but
> > I want to make my module available to other perl programmers, and let them
> have
> > the flexibility of deciding which use statements they want from the
> module.
> 
> Wait a minute. Someone's being silly. Unless you're talking about groups
> of modules, you (or they) should 'use' them by the original names. But
> to answer your question, change the main script as follows.
> 
> #!/usr/bin/perl
> 
> use strict;
> use warnings;
> 
> BEGIN {
>    our $use_parameter = 'secret_code';
> }
> use PerlMQ;
> 
> __END__
> 
> 
> # PerlMQ
> 
> our $use_parameter;
> use if $use_parameter eq 'secret_code', Module => undef;
> 
> 1;
> __END__
> 
> 
> 
> -- 
> 
> Just my 0.00000002 million dollars worth,
>     --- Shawn
> 
> "Probability is now one. Any problems that are left are your own."
>     SS Heart of Gold, _The Hitchhiker's Guide to the Galaxy_
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
> 
> 
> 
> ----------------------------------------
> This mail sent through www.mywaterloo.ca
> 




----------------------------------------
This mail sent through www.mywaterloo.ca

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to