NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Odd - Pug's state worked correctly back in 2005 (Score:1)
Re:Odd - Pug's state worked correctly back in 2005 (Score:2)
I don't think that it did. Certainly, that example is not a good enough test, because it makes all three calls to
gen_cashierbefore it uses any of the closures, so it makes no difference how many times that assignment of0is performed. If I re-write it like thisthen I get the wrong answer:
If I remove the assignment of
0, and rely onundefbecoming0:then I get back to the right answer:
stateis doing something though here - a single variable is being shared between all 3 closures. To get the same effect withmyI have to hoistmy $cash_in_storeoutside ofsub gen_cashierIn conclusion, I don't think that
statein Pugs has regressed - it never worked quite as well the example implied.Reply to This
Parent