Big5
view release on metacpan or search on metacpan
lib/Big5.pm view on Meta::CPAN
and rewrite "use $package;" to "use @{[__PACKAGE__]}::$package;" of script "$0".
END
}
# P.302 Module Privacy and the Exporter
# in Chapter 11: Modules
# of ISBN 0-596-00027-8 Programming Perl Third Edition.
#
# A module can do anything it jolly well pleases when it's used, since use just
# calls the ordinary import method for the module, and you can define that
# method to do anything you like.
# P.406 Module Privacy and the Exporter
# in Chapter 11: Modules
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
#
# A module can do anything it jolly well pleases when it's used, since use just
# calls the ordinary import method for the module, and you can define that
# method to do anything you like.
sub import {
if (Ebig5::e("$filename.e")) {
if (exists $ENV{'CHAR_DEBUG'}) {
Ebig5::unlink "$filename.e";
}
elsif (Ebig5::z("$filename.e")) {
Ebig5::unlink "$filename.e";
}
else {
#----------------------------------------------------
# older >
# newer >>>>>
#----------------------------------------------------
# Filter >
# Source >>>>>
# Escape >>> needs re-escape (Source was changed)
#
# Filter >>>
# Source >>>>>
# Escape > needs re-escape (Source was changed)
#
# Filter >>>>>
# Source >>>
# Escape > needs re-escape (Source was changed)
#
# Filter >>>>>
# Source >
# Escape >>> needs re-escape (Filter was changed)
#
# Filter >
# Source >>>
# Escape >>>>> executable without re-escape
#
# Filter >>>
# Source >
# Escape >>>>> executable without re-escape
#----------------------------------------------------
my $mtime_filter = (Ebig5::stat(__FILE__ ))[9];
my $mtime_source = (Ebig5::stat($filename ))[9];
my $mtime_escape = (Ebig5::stat("$filename.e"))[9];
if (($mtime_escape < $mtime_source) or ($mtime_escape < $mtime_filter)) {
Ebig5::unlink "$filename.e";
}
}
}
if (not Ebig5::e("$filename.e")) {
my $fh = gensym();
Ebig5::_open_a($fh, "$filename.e") or die __FILE__, ": Can't write open file: $filename.e\n";
# 7.19. Flushing Output
# in Chapter 7. File Access
# of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
select((select($fh), $|=1)[0]);
if (0) {
}
elsif (exists $ENV{'CHAR_NONBLOCK'}) {
# P.419 File Locking
# in Chapter 16: Interprocess Communication
# of ISBN 0-596-00027-8 Programming Perl Third Edition.
# P.524 File Locking
# in Chapter 15: Interprocess Communication
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
# P.571 Handling Race Conditions
# in Chapter 23: Security
# of ISBN 0-596-00027-8 Programming Perl Third Edition.
# P.663 Handling Race Conditions
# in Chapter 20: Security
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
# (and so on)
CORE::eval q{ flock($fh, LOCK_EX | LOCK_NB) };
if ($@) {
die __FILE__, ": Can't immediately write-lock the file: $filename.e\n";
}
}
else {
CORE::eval q{ flock($fh, LOCK_EX) };
}
CORE::eval q{ truncate($fh, 0) };
seek($fh, 0, 0) or die __FILE__, ": Can't seek file: $filename.e\n";
my $e_script = Big5::escape_script($filename);
print {$fh} $e_script;
my $mode = (Ebig5::stat($filename))[2] & 0777;
chmod $mode, "$filename.e";
close($fh) or die "Can't close file: $filename.e: $!";
}
my $fh = gensym();
Ebig5::_open_r($fh, "$filename.e") or die __FILE__, ": Can't read open file: $filename.e\n";
if (0) {
}
elsif (exists $ENV{'CHAR_NONBLOCK'}) {
CORE::eval q{ flock($fh, LOCK_SH | LOCK_NB) };
if ($@) {
die __FILE__, ": Can't immediately read-lock the file: $filename.e\n";
}
}
else {
CORE::eval q{ flock($fh, LOCK_SH) };
}
my @switch = ();
if ($^W) {
push @switch, '-w';
}
if (defined $^I) {
push @switch, '-i' . $^I;
undef $^I;
}
# P.707 29.2.33. exec
# in Chapter 29: Functions
# of ISBN 0-596-00027-8 Programming Perl Third Edition.
#
# If there is more than one argument in LIST, or if LIST is an array with more
# than one value, the system shell will never be used. This also bypasses any
# shell processing of the command. The presence or absence of metacharacters in
# the arguments doesn't affect this list-triggered behavior, which makes it the
# preferred from in security-conscious programs that do not with to expose
# themselves to potential shell escapes.
# Environment variable PERL5SHELL(Microsoft ports only) will never be used, too.
# P.855 exec
# in Chapter 27: Functions
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
#
# If there is more than one argument in LIST, or if LIST is an array with more
# than one value, the system shell will never be used. This also bypasses any
# shell processing of the command. The presence or absence of metacharacters in
# the arguments doesn't affect this list-triggered behavior, which makes it the
# preferred from in security-conscious programs that do not wish to expose
# themselves to injection attacks via shell escapes.
# Environment variable PERL5SHELL(Microsoft ports only) will never be used, too.
# P.489 #! and Quoting on Non-Unix Systems
# in Chapter 19: The Command-Line Interface
# of ISBN 0-596-00027-8 Programming Perl Third Edition.
# P.578 #! and Quoting on Non-Unix Systems
# in Chapter 17: The Command-Line Interface
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
lib/Big5.pm view on Meta::CPAN
expression.
perl 5.6 or later --- ActivePerl on MSWin32
perl 5.10.1 or later --- other Perl
see also,
In 5.10.0, the * quantifier in patterns was sometimes treated as {0,32767}
http://perldoc.perl.org/perl5101delta.html
[perl #116379] \G can't treat over 32767 octet
http://www.nntp.perl.org/group/perl.perl5.porters/2013/01/msg197320.html
perlre - Perl regular expressions
http://perldoc.perl.org/perlre.html
perlre length limit
http://stackoverflow.com/questions/4592467/perlre-length-limit
Japanese Document
Big5/JA.pm
=item * Empty Variable in Regular Expression
Unlike literal null string, an interpolated variable evaluated to the empty string
can't use the most recent pattern from a previous successful regular expression.
=item * Limitation of ?? and m??
Multibyte character needs ( ) which is before {n,m}, {n,}, {n}, *, and + in ?? or m??.
As a result, you need to rewrite a script about $1,$2,$3,... You cannot use (?: )
?, {n,m}?, {n,}?, and {n}? in ?? and m??, because delimiter of m?? is '?'.
=item * Look-behind Assertion
The look-behind assertion like (?<=[A-Z]) is not prevented from matching trail
octet of the previous multiple-octet code.
=item * Modifier /a /d /l and /u of Regular Expression
The concept of this software is not to use two or more encoding methods as
literal string and literal of regexp in one Perl script. Therefore, modifier
/a, /d, /l, and /u are not supported.
\d means [0-9] universally.
=item * Named Character
A named character, such \N{GREEK SMALL LETTER EPSILON}, \N{greek:epsilon}, or
\N{epsilon} is not supported.
=item * Unicode Properties (aka Character Properties) of Regular Expression
Unicode properties (aka character properties) of regexp are not available.
Also (?[]) in regexp of Perl 5.18 is not available. There is no plans to currently
support these.
=item * ${^WIN32_SLOPPY_STAT} is ignored
Even if ${^WIN32_SLOPPY_STAT} is set to a true value, file test functions Ebig5::*(),
Ebig5::lstat(), and Ebig5::stat() on Microsoft Windows open the file for the path
which has chr(0x5c) at end.
=item * Delimiter of String and Regexp
qq//, q//, qw//, qx//, qr//, m//, s///, tr///, and y/// can't use a wide character
as the delimiter.
=item * \b{...} Boundaries in Regular Expressions
Following \b{...} available starting in v5.22 are not supported.
\b{gcb} or \b{g} Unicode "Grapheme Cluster Boundary"
\b{sb} Unicode "Sentence Boundary"
\b{wb} Unicode "Word Boundary"
\B{gcb} or \B{g} Unicode "Grapheme Cluster Boundary" doesn't match
\B{sb} Unicode "Sentence Boundary" doesn't match
\B{wb} Unicode "Word Boundary" doesn't match
=back
=head1 AUTHOR
INABA Hitoshi E<lt>ina@cpan.orgE<gt>
This project was originated by INABA Hitoshi.
=head1 LICENSE AND COPYRIGHT
This software is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. See L<perlartistic>.
This software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
=head1 My Goal
P.401 See chapter 15: Unicode
of ISBN 0-596-00027-8 Programming Perl Third Edition.
Before the introduction of Unicode support in perl, The eq operator
just compared the byte-strings represented by two scalars. Beginning
with perl 5.8, eq compares two byte-strings with simultaneous
consideration of the UTF8 flag.
/* You are not expected to understand this */
Information processing model beginning with perl 5.8
+----------------------+---------------------+
| Text strings | |
+----------+-----------| Binary strings |
| UTF-8 | Latin-1 | |
+----------+-----------+---------------------+
| UTF8 | Not UTF8 |
| Flagged | Flagged |
+--------------------------------------------+
http://perl-users.jp/articles/advent-calendar/2010/casual/4
Confusion of Perl string model is made from double meanings of
( run in 1.700 second using v1.01-cache-2.11-cpan-99c4e6809bf )