in reply to Re: Concurrent lexical scopes?
in thread Concurrent lexical scopes?
#!/usr/bin/perl -w use strict; use lib '.'; use Sub::Lexical; my sub testsub { print "testsub 1 called\n"; } my sub outersub { print "outersub called\n"; testsub(); } for (1) { my sub testsub { print "testsub 2 called\n"; } testsub(); outersub(); }
This outputs:
testsub 2 called outersub called testsub 2 called
While it probably SHOULD give:
Because the first testsub() declaration is in lexical scope for outersub()testsub 2 called outersub called testsub 1 called
This could be considered a feature, if you just rename your module to Sub::Local... :-)
-- Joost downtime n. The period during which a system is error-free and immune from user input.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Concurrent lexical scopes?
by broquaint (Abbot) on Jun 12, 2002 at 11:41 UTC |