[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
Re: [ID 20000123.003] [BUG our() 5.005_63] Lexical scoping problems.
our() doesn't have any "local" component in it.
Consider:
# CASE 0: grant access to global during scope,
# but assign to it forever
our $var = "fred";
is really like
# CASE 1: (same as previous)
our $var;
$var = "fred";
rather than like
# CASE 2: grant access to global during scope,
# and also assign it a new, run-time value
# for this block only
our $var;
local $var = "fred";
In other words, the duration of a run-time assignment in a
compiler-noted our() declaration on a global is itself permanent
in effect and wholly unconcerned with blocks, even though the
"use-strict-legal" visibility conferred by the our() modifier is
restricted to that lexical block.
You'd be wanting
local our $var = "fred";
if you're expecting both. (And yes, it should be "our local" in
English.)
--tom
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]