Changes for version 0.67 - 2026-11-18
- support Perl 5.44 syntax (lib/mb.pm itself still runs on Perl 5.005_03 and later): (1) use feature 'enhanced_xx': a codepoint class [...] of /xx may extend over multiple lines, and "#" in it starts a comment that may absorb "]". mb now looks ahead the modifiers of m//, qr//, s///, split // and m'' before parsing the regular expression, and when /xx is given while enhanced_xx is enabled, removes the comments and the vertical spaces of the codepoint class by itself. enhanced_xx is enabled by use feature / use experimental naming enhanced_xx or :all, disabled by no feature naming enhanced_xx or :all, bare "no feature;", and "use VERSION" of any version and spelling (use v5.44, use 5.010, use 5.36.0, use v5.8, use 5.006; perlfunc: use VERSION disables any feature not in the bundle of that version), and the change is effective to the end of the enclosing block, as Perl does. "use if COND, feature => 'enhanced_xx';" is followed on Perl 5.44 and later (COND is not evaluated). mb::eval inherits enhanced_xx enabled at its caller (perl 5.10 and later). Under enhanced_xx, a codepoint class whose "]" was absorbed by a comment (/[a#]/xx) now dies with "Unmatched [ in regex" and a hint, as Perl 5.44 does, instead of "something wrong happened". Since mb removes the comments, mb gives the comment warnings of Perl 5.44 ("Did you mean this to be a comment?", "Did you mean to have a second '#' in your comment?", "Did you mean to have a ']' in your comment?") at transpile time, under use warnings (all or regexp, or use v5.35 and later) or -w; no warnings stops them to the end of the block. (2) named parameters in signatures (sub f ($x, :$alpha, :$beta = 1)) and multi-variable foreach with reference aliases (foreach my ($key, \@items) (%hash)) are passed through; tests added.
- fix: "use v5.36;", "no v5.10;", "use Module v1.2.3;" and "require v5.6.1;" were transpiled as "use mb::chr(5).mb::chr(36);" etc., so every script beginning with "use vN.NN;" (including "use v5.44;") failed with "Can't locate mb/chr.pm". The version after use / no / use Module / require is now passed through as-is. A version string in other places (my $s = v65.66;) is still a string of codepoints.
- fix: /xx removed newline, form feed and carriage return from a codepoint class. As perlre says, /xx ignores only unescaped tab and space there.
- fix: escaped space and tab in a codepoint class of /xx ([\ ], m'[\ ]'xx) were removed (or broke the regular expression); they now match a space and a tab. Unescaped space and tab of m'[...]'xx are now removed at transpile time.
- fix: a comment of /x or /xx containing "[" broke the transpile. Since the modifiers are looked ahead, comments of /x outside of a codepoint class are now removed (the end of line is kept, so line numbers are not shifted).
- "#" and white space in a codepoint class are now written as \xHH in the regular expression generated by mb::_cc(), so that the generated regular expression means the same under /x, /xx and /xx with enhanced_xx, and causes no deprecation warning of Perl 5.44 for an unescaped "#" or literal vertical space in a bracketed class under /xx.
- fix: an escaped "]" or "[" in a codepoint class ([\]a], [\[a], [^\]]) closed the class or broke qq[...] of the transpiled script.
- (?#comment) is now removed, so a "[" in it no longer breaks the transpile. $#array, $#{expr} and \c# never start a comment of /x.
- fix: \Q...\E in a regular expression was transpiled as a regular expression and then quoted, so /a\Q.\Eb/ did not match "a.b" and /a\Q[\Eb/ broke the transpiled script. It is now a string, as Perl does: a backslash and the next character in it are both literal (/\Q\n\E/ matches a backslash and "n"), except an escaped delimiter of non-bracket. Under /x, "#" in \Q...\E is quoted up to the end of line, including "\E" in it, as Perl tokenizer does.
- t/lib/INA_CPAN_Check.pm 0.46 (from master 0.45: _first_lines() is now given [ @array ] instead of \@array, for K2 of t/9040-style.t).
- pmake.bat 0.53 (from 0.52): the prerequisite scanner took example source in a here-document of a test ("use feature 'enhanced_xx';" and "use v5.44;" at column zero in t/5010_perl544.t) for real "use" statements, and META declared "v5.44", "feature" and "experimental" as test prerequisites, which no CPAN client can satisfy on the perls mb supports. Here-document bodies (and __END__ / __DATA__) are now blanked before the scan, POD and comments before the here-documents, "use VERSION" in any spelling (5.006, 5.6.1, v5.44) is a perl version, and pmake dist aborts rather than write a prerequisite that is not a module name.
- add t/9032-meta_prereqs.t (9 tests): every prerequisite in META.yml and META.json is a module name, every required module is core in perl 5.005_03 and loads, "feature", "experimental" and "vN" are never declared, and both files agree. pmake dist writes META before it runs the suite, so a dist with such a prerequisite is aborted.
- fix: an escaped delimiter in a codepoint class (m/[^\/]/, m{[\}]}, s/[\/]/-/, split /[\/]/, qr/[\/]/, m#[\#]#, ...) was written unescaped into qq[...] of the transpiled qr/.../, which closed it, and the transpiled script died ("Can't find string terminator" or a syntax error). It is now written as \\\xHH (\\\x2F for \/), so no delimiter octet is left in the transpiled script; \\\/ was not enough on Perl 5.005_03, which removes the backslash of \} at the outer m{...} and closed the nested qr{...} early. Add t/3034_charclass_escaped_delimiter.t (126 tests: every kind of delimiter, with and without /x and /xx, sjis and utf8, and the transpiled form, which catches the Perl 5.005_03 failure on any perl).
- fix t/9001-load.t: ok($mb::VERSION =~ /.../, ...) evaluated the match in list context, so it could never fail (found by K4 of pmake.bat 0.52).
- fix: $\ (output record separator) followed by \E, \b etc. was not taken as $\. As Perl does, it is now interpolated in a double-quoted string and in a regular expression, and the next character is a literal character: "a\Q$\E" (was a broken script) is "a".quotemeta($\."E"), and /a$\b/ (was "a", an end of line anchor and \b) matches "a".$\."b".
- add t/5010_perl544.t (140 tests; 4 of them run only on Perl 5.44, 5.10 or 5.6 and later).
- every test now runs without a warning under -w: expected warnings of t/5010_perl544.t, t/5005_tr.t and t/5007_opendir.t are caught, and qw() lists with "#" and "," of t/2041_quote_tr_y.t and t/2042_quote_damemoji_tr_y.t are rewritten (the tested delimiters are unchanged).
- POD: the deprecation warnings of Perl 5.44 are now quoted as Perl gives them ("Use of unescaped '#' in [] is deprecated under /xx" and "Use of literal vertical space in [] is deprecated under /xx").
- POD: add "Perl 5.44 Syntax"; supported perl versions are now "5.005_03 to perl 5.44". README: add "PERL 5.44 SYNTAX".
- POD: note that each number of a version string outside use / no / require is given to mb::chr(), so v1.22.333 is "1.22.1.77" by sprintf("%vd", ...) (not new in this version).
Documentation
Modules
Can easy script in Big5, Big5-HKSCS, GBK, Sjis(also CP932), UHC, UTF-8, ...
Examples
- eg/bm/mb_length.pl
- eg/bm/mb_practical.pl
- eg/bm/mb_regexp.pl
- eg/bm/mb_split.pl
- eg/bm/mb_tr.pl
- eg/bn/mb_length.pl
- eg/bn/mb_practical.pl
- eg/bn/mb_regexp.pl
- eg/bn/mb_split.pl
- eg/bn/mb_tr.pl
- eg/en/mb_length.pl
- eg/en/mb_practical.pl
- eg/en/mb_regexp.pl
- eg/en/mb_split.pl
- eg/en/mb_tr.pl
- eg/fr/mb_length.pl
- eg/fr/mb_practical.pl
- eg/fr/mb_regexp.pl
- eg/fr/mb_split.pl
- eg/fr/mb_tr.pl
- eg/hi/mb_length.pl
- eg/hi/mb_practical.pl
- eg/hi/mb_regexp.pl
- eg/hi/mb_split.pl
- eg/hi/mb_tr.pl
- eg/id/mb_length.pl
- eg/id/mb_practical.pl
- eg/id/mb_regexp.pl
- eg/id/mb_split.pl
- eg/id/mb_tr.pl
- eg/ja/mb_length.pl
- eg/ja/mb_practical.pl
- eg/ja/mb_regexp.pl
- eg/ja/mb_split.pl
- eg/ja/mb_tr.pl
- eg/km/mb_length.pl
- eg/km/mb_practical.pl
- eg/km/mb_regexp.pl
- eg/km/mb_split.pl
- eg/km/mb_tr.pl
- eg/ko/mb_length.pl
- eg/ko/mb_practical.pl
- eg/ko/mb_regexp.pl
- eg/ko/mb_split.pl
- eg/ko/mb_tr.pl
- eg/mb_length.pl
- eg/mn/mb_length.pl
- eg/mn/mb_practical.pl
- eg/mn/mb_regexp.pl
- eg/mn/mb_split.pl
- eg/mn/mb_tr.pl
- eg/my/mb_length.pl
- eg/my/mb_practical.pl
- eg/my/mb_regexp.pl
- eg/my/mb_split.pl
- eg/my/mb_tr.pl
- eg/ne/mb_length.pl
- eg/ne/mb_practical.pl
- eg/ne/mb_regexp.pl
- eg/ne/mb_split.pl
- eg/ne/mb_tr.pl
- eg/si/mb_length.pl
- eg/si/mb_practical.pl
- eg/si/mb_regexp.pl
- eg/si/mb_split.pl
- eg/si/mb_tr.pl
- eg/th/mb_length.pl
- eg/th/mb_practical.pl
- eg/th/mb_regexp.pl
- eg/th/mb_split.pl
- eg/th/mb_tr.pl
- eg/tl/mb_length.pl
- eg/tl/mb_practical.pl
- eg/tl/mb_regexp.pl
- eg/tl/mb_split.pl
- eg/tl/mb_tr.pl
- eg/tr/mb_length.pl
- eg/tr/mb_practical.pl
- eg/tr/mb_regexp.pl
- eg/tr/mb_split.pl
- eg/tr/mb_tr.pl
- eg/tw/mb_length.pl
- eg/tw/mb_practical.pl
- eg/tw/mb_regexp.pl
- eg/tw/mb_split.pl
- eg/tw/mb_tr.pl
- eg/ur/mb_length.pl
- eg/ur/mb_practical.pl
- eg/ur/mb_regexp.pl
- eg/ur/mb_split.pl
- eg/ur/mb_tr.pl
- eg/uz/mb_length.pl
- eg/uz/mb_practical.pl
- eg/uz/mb_regexp.pl
- eg/uz/mb_split.pl
- eg/uz/mb_tr.pl
- eg/vi/mb_length.pl
- eg/vi/mb_practical.pl
- eg/vi/mb_regexp.pl
- eg/vi/mb_split.pl
- eg/vi/mb_tr.pl
- eg/zh/mb_length.pl
- eg/zh/mb_practical.pl
- eg/zh/mb_regexp.pl
- eg/zh/mb_split.pl
- eg/zh/mb_tr.pl