I18N::Japanese(3)

NAME
Japanese - Perl pragma to control whether some built-in operations understand
    composite characters or not.

SYNOPSIS
use I18N::Japanese qw(re tr format); no I18N::Japanese qw(re tr format);

DESCRIPTION
This module is actually a pragma module, though it begins with capital J. Import/unimport takes list of strings.

    Enables Japanized regexp, including split.

    Enables Japanized tr//.

    Enables Japanized format.

    As usual, omitting the arguments means specifying all the bits.
    The setting is valid only within the current block.

=cut
# ウラワザ : 0x8000000 は，文字列定数で2バイト文字を認識するかどうか sub import {
    shift;
    my $bits = 0;
    @_ = qw(re tr format string) if (@_ == 0);
    for (@_) {
    $bits |= 0x1000000 if $_ eq 're';
    $bits |= 0x2000000 if $_ eq 'tr';
    $bits |= 0x4000000 if $_ eq 'format';
    $bits |= 0x8000000 if $_ eq 'string';
    } # $bits |= 0x8000000 if ($bits != 0);

    $^H |= $bits;
    #print "imp : hints = $bits\n"; }

sub unimport {
    shift;
    my $bits = 0;
    @_ = qw(re tr format string) if (@_ == 0);
    for (@_) {
    $bits |= 0x1000000 if $_ eq 're';
    $bits |= 0x2000000 if $_ eq 'tr';
    $bits |= 0x4000000 if $_ eq 'format';
    $bits |= 0x8000000 if $_ eq 'string';
    } # $bits = 0x8000000 if ($^H != 0x8000000 && $bits == 0);
    $^H &= ~$bits;
    #print "unimp : hints = $bits\n"; }

1;
    composite characters or not."