camel

ź��Ȥ�����ꡢ���礦��utf8 pragma����������Τˤ�������ʤΤǡ�

�Ϥ��٤ˤä�# - Web::Scraper����!
my $left = decode_utf8('��'); 
my $right = decode_utf8('��'); 

������ץȤ�UTF-8�ǽ񤫤�Ƥ�����ϡ��虜�虜decode_utf8('��ƥ��');�Ȥ����ꡢ�ǽ��use utf8;�Ȥ��Ƥ����Τ��ȡ�

�����������餫�ˤ��뤿��ˡ��ʲ���code snippet�򼨤���

#!/usr/local/bin/perl
use strict;
use warnings;
use Encode ();
use Devel::Peek;
{
    use utf8;
    my $name = '������';
    warn Encode::is_utf8($name)+0;
    Dump $name; 
}
{
    use bytes;
    my $name = '������';
    warn Encode::is_utf8($name)+0;
    Dump $name; 
}
1 at dankogai.pl line 9.
SV = PV(0x1802060) at 0x1820ce8
  REFCNT = 1
  FLAGS = (PADBUSY,PADMY,POK,pPOK,UTF8)
  PV = 0x6018e0 "\345\260\217\351\243\274\345\274\276"\0 [UTF8 "\x{5c0f}\x{98fc}\x{5f3e}"]
  CUR = 9
  LEN = 12
0 at dankogai.pl line 15.
SV = PV(0x18020c0) at 0x1821b38
  REFCNT = 1
  FLAGS = (PADBUSY,PADMY,POK,pPOK)
  PV = 0x613630 "\345\260\217\351\243\274\345\274\276"\0
  CUR = 9
  LEN = 12

���Ƥ��̤ꡢutf8 pragma��lexical scope�ʤΤǡ��ɽ�Ū�˰������Ѥ������Ǥ��롣��äƥ����������ɤ�UTF-8�ǽ񤫤�Ƥ����顢use strict;��use warnings;�Τ�������use utf8;��������Ƥ����Ȥ褤��������

���ʤߤˡ�utf8 pragma���۲��Ǥϡ���ƥ������ǤϤʤ�����ܥ�̾�ˤ�Unicode��Ȥ����Ȥ�����롣

#!/usr/local/bin/perl
use strict;
use warnings;
use utf8;

{
    package ��;
    sub ��{
        my $�ѥå����� = shift;
        bless {}, $�ѥå�����;
    }
    sub ��{
        my $������ = shift;
        $������->{��} = shift if @_;
        $������->{��}
    }

    sub ̾{
        my $�� = shift;
        $��->{̾} = shift if @_;
        $��->{̾};
    }
    sub ��̾{
        my $�� = shift;
        $��->{��} . $��->{̾};
    }
}

my $�� = ��->��();
$��->��('����');
$��->̾('��');
binmode STDOUT, ':utf8';
print $��->��̾, "\n";

Enjoy!

Dan the Just Another PerlUnicode Hacker