perl-unicode

Re: Unicode aware module

1999-06-12 00:33:52
On Fri, 11 Jun 1999 18:34:55 EDT, Ilya Zakharevich wrote:
Thanks, this is what I was advocating for many years.

+=item caller
+
+Allows modules to inherit pragmatic attributes from the caller's
+context.  C<utf8> is currently the only supported attribute.

locale should be supported too.

HINT_UTF8 gets stuffed into every COP.  HINT_LOCALE isn't, and
it isn't clear if it should be.  HINT_LOCALE will have to move
down to the lower 8 bits of PL_hints for that.

                                And can you put

 use caller 'attribute'

at the top of the module?

Sure.  The scoping is just the same as C<use utf8>.

Anyway, one should be able to make

 use caller 'utf8 locale';

the default, as in

 use globalcaller 'utf8 locale';

Well, it would be simpler to just do it the way warnings
are done.  Have a single global on/off flag, and let them
use the pragma for finer control.

But I dislike the idea of a global switch for utf8.  There
is no graceful way to detect if some code was never indended
to be run in utf8 mode (assume it processes GIF files, or
other random binary data).

with modules able to switch it off by

 use nocaller 'utf8 locale';

This violates the "C<no foo;> should be the default" dictum.

BTW, the caller.pm I sent earlier was half-baked.  I've
attached the fixed version.


Sarathy
gsar(_at_)activestate(_dot_)com
-----------------------------------8<-----------------------------------
Change 3536 by gsar(_at_)sparc26 on 1999/06/12 06:38:21

        caller.pm typos

Affected files ...

... //depot/perl/lib/caller.pm#2 edit

Differences ...

==== //depot/perl/lib/caller.pm#2 (text) ====
Index: perl/lib/caller.pm
--- perl/lib/caller.pm.~1~      Fri Jun 11 20:34:17 1999
+++ perl/lib/caller.pm  Fri Jun 11 20:34:17 1999
@@ -33,7 +33,7 @@
 
 =cut
 
-my %bits = (
+my %bitmask = (
     # only HINT_UTF8 supported for now
     encoding => 0x8
 );
@@ -48,9 +48,7 @@
     shift;
     my @cxt = caller(3);
     if (@cxt and $cxt[7]) {    # was our parent require-d?
-       #warn "hints was $^H\n";
-       $^H |= bits(@_) | $cxt[8];
-       #warn "hints now $^H\n";
+       $^H |= bits(@_) & $cxt[8];
     }
 }
 
End of Patch.

<Prev in Thread] Current Thread [Next in Thread>