At 04:19 PM 4/22/99 , Larry Wall wrote:
Dick Hardt writes:
: I don't think that is necessary, I think the 'right' thing happens
already.
:
: sub abc {
: # we are in the mode of who called us;
: # code here
: }
:
: {
: use utf8;
: abc(); # abc() will be run with utf8==TRUE
: }
: {
: no utf8;
: abc(); # abc() will be run with utf8==FALSE
: }
:
: So if you are dealing with characters, there are no problems, you will be
: in the mode of the caller.
Er, nope, that's not what happens. You're confusing dynamic scoping with
lexical scoping. sub abc will always execute in 'no utf8', unless it's
in the *lexical* scope of a 'use utf8' declaration.
Oh.... Hmmm.... So Graham's point about wanting to know the context of the
caller is important then.
For example, the Win32::* modules can be updated so that depending on
whether utf8 was set or not, W or A calls to the OS would be made. To do
this, the subs will need to know the context of the caller.
W|A function backgrounder
In Win32, if a function Foo() has string parameters, then there is no Foo()
function. There is a Foo() macro that gets defiend as either FooA() and
FooW() depending on the state of the Unicode #defines. In FooW() all
strings are encoded as Unicode, and in FooA() all strings are in the locale
encoding.
-- Dick