Re: Problem with use strict

2002-10-30 Thread $Bill Luebkert
Karl-Heinz Kuth wrote:

I have a problem with "use strict":

There are two files. The file "test_template.pl" calls the file "test_modul.pl"
via a variable. I read this file name from an ini-file. But for the example
I wrote it into a variable ($modul).

File: "test_template.pl":

use strict;
my $Simulation = "y";
my $modul = "e:\\temp\\test_modul.pl";
print "Simulation before:  $Simulation \n";
require $modul;
print "Simulation after:   $Simulation \n";

File: "test_modul.pl"

use strict;
$main::Simulation = "f";
print "Simulation modul:   $main::Simulation \n";

If I call "test_template.pl", I will get the following output:
Simulation before: y
Simulation modul:  f
Simulation after;  y

But I want to get 
Simuation after :  f

How do I have to change the code in the file "test_modul.pl", so that
the value of the variable "$Simulation" is also changed in the
"test_template.pl"?

The 'my' is killing you due to it's special scoping.  Try 'our' instead or
use 'use vars qw(Simulation);' and drop the my.

--
  ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
 (_/   /  )// //   DBE Collectibles   Mailto:dbe@;todbe.com
  / ) /--<  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_http://www.todbe.com/

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Problem with use strict

2002-10-30 Thread Karl-Heinz Kuth

I have a problem with "use strict":

There are two files. The file "test_template.pl" calls the file "test_modul.pl"
via a variable. I read this file name from an ini-file. But for the example
I wrote it into a variable ($modul).

File: "test_template.pl":

use strict;
my $Simulation = "y";
my $modul = "e:\\temp\\test_modul.pl";
print "Simulation before:  $Simulation \n";
require $modul;
print "Simulation after:   $Simulation \n";

File: "test_modul.pl"

use strict;
$main::Simulation = "f";
print "Simulation modul:   $main::Simulation \n";

If I call "test_template.pl", I will get the following output:
Simulation before: y
Simulation modul:  f
Simulation after;  y

But I want to get 
Simuation after :  f

How do I have to change the code in the file "test_modul.pl", so that
the value of the variable "$Simulation" is also changed in the
"test_template.pl"?

Thanks in advance!

Bye
Karl-Heinz

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs