Re: Include variables from external perl script
- From: rkb@xxxxxxxxxx (Ron Bergin)
- Date: Tue, 30 Oct 2007 12:16:07 -0700
On Oct 30, 7:50 am, mri...@xxxxxxxxx (Paul Lalli) wrote:
On Oct 30, 9:38 am, r...@xxxxxxxxxx (Ron Bergin) wrote:
On 10/30/07, howa <howac...@xxxxxxxxx> wrote:
Consider the example below...
Config.pl
======
#!/usr/bin/perl -w
In addition to changing 'my' to our' in Config.pl, you'll also need tomy $value = "abc";
add the 'our $value;' to Script.pl
Blatantly untrue. The OP was not using strict. 'our' is only
required to be able to refer to global variables without qualifying
them when strict 'vars' is in use. If there is no strict, 'our' is a
no-op.
Paul Lalli
I wouldn't say that it was "Blatantly untrue". However, I did neglect
to include my normal qualification instructing the person to always
use the strict and warnings pragmas like I did in the optional method
that I posted. With the inclusion of the strict pragma, then the use
of 'our' in Script.pl would be needed.
The OP didn't show us the shebang for the Script.pl, but since the -w
switch is being used in Config.pl, it's a fair assumption that it's
being used in Script.pl. Assuming that to be true, failing to use
'our' in Script.pl will generate the following warning.
Name "main::value" used only once: possible typo at ....
.
- References:
- Include variables from external perl script
- From: Howa
- Re: Include variables from external perl script
- From: Jeff Pang
- Re: Include variables from external perl script
- From: Ron Bergin
- Re: Include variables from external perl script
- From: Paul Lalli
- Include variables from external perl script
- Prev by Date: RE: Pragmas use strict and use warnings
- Next by Date: Re: Include variables from external perl script
- Previous by thread: Re: Include variables from external perl script
- Next by thread: Re: Include variables from external perl script
- Index(es):
Relevant Pages
|