Skip to content

Commit

Permalink
* Be even more clear about $EastAsianWidth needing to be set at BEGIN…
Browse files Browse the repository at this point in the history
… time.
  • Loading branch information
audreyt committed May 13, 2012
1 parent d6d2a8c commit 32b8133
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
17 changes: 7 additions & 10 deletions lib/Unicode/EastAsianWidth.pm
Original file line number Diff line number Diff line change
Expand Up @@ -467,20 +467,17 @@ C<InHalfwidth> (union of C<Halfwidth>, C<Narrow> and C<Neutral>).
I<Ambiguous> characters are treated by default as part of
C<InHalfwidth>, but you can modify this behaviour by assigning
a true value to C<$Unicode::EastAsianWidth::EastAsian>.
=head1 CAVEATS
Setting C<$Unicode::EastAsianWidth::EastAsian> at run-time only
works on Perl versions between 5.8 and 5.14, due to an implementation
detail that enabled this functionality.
For Perl <=5.6 and Perl >=5.16 versions, please use a BEGIN block
to set the flag before the C<use> statement:
a true value to C<$Unicode::EastAsianWidth::EastAsian> at compile time
within a C<BEGIN> block before loading this module:
BEGIN { $Unicode::EastAsianWidth::EastAsian = 1 }
use Unicode::EastAsianWidth;
Setting C<$Unicode::EastAsianWidth::EastAsian> at run-time used to
work on Perl versions between 5.8 and 5.14 due to an implementation
detail, but it will no longer work on Perl 5.16 and later versions,
and hence is not recommended.
=head1 SEE ALSO
L<perlunicode>,
Expand Down
2 changes: 1 addition & 1 deletion t/1-basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $_ = chr(0x2010);
ok(/\p{InEastAsianAmbiguous}/);
ok(!/\p{InFullwidth}/);

if ($] >= 5.008 and $] < 5.016) {
if ($] >= 5.008 and $] < 5.015) {
no warnings 'once';
local $Unicode::EastAsianWidth::EastAsian = 1;
ok(/\p{InFullwidth}/);
Expand Down

0 comments on commit 32b8133

Please sign in to comment.