Enfileyb has asked for the wisdom of the Perl Monks concerning the following question:
functions.pm:package config; use strict; our $configvariable = 1; return 1; sub setconfigvariable { $configvariable = shift; } sub getconfigvariable { return $configvariable; }
Script.pl:package functions; use strict; use config; return 1; sub printconfigvariable { print config::getconfigvariable; }
Why does the function from die functions.pm-module not use the changed value? What can i do to get the behaviour i expect? Thanks in advance, Enfileybuse strict; use config; use functions; print config::getconfigvariable; # 1 functions::printconfigvariable; # 1 config::setconfigvariable(2); print config::getconfigvariable; # 2 functions::printconfigvariable; # 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem with setting Variables in Perl Modules
by cdarke (Prior) on Nov 20, 2009 at 13:05 UTC | |
by Fletch (Bishop) on Nov 20, 2009 at 13:56 UTC | |
by ikegami (Patriarch) on Nov 20, 2009 at 16:22 UTC | |
|
Re: Problem with setting Variables in Perl Modules
by jethro (Monsignor) on Nov 20, 2009 at 12:54 UTC | |
|
Re: Problem with setting Variables in Perl Modules
by Enfileyb (Initiate) on Nov 20, 2009 at 14:11 UTC |