UTF8-R2

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

  - add t/9060-readme.t: README required sections R1-R4 check (9 tests)
  - add SECURITY.md
  - fix lib/UTF8/R2.pm: warnings stub now guards with
    !defined(&warnings::import) to suppress "import redefined" warnings
  - fix lib/UTF8/R2.pm: copyright year 2026 added
  - fix lib/UTF8/R2.pm: caller() return value variables now spaced
  - fix lib/UTF8/R2.pm: keep \\%mb for tied hash (reverted { %mb })
  - fix lib/UTF8/R2.pm: CORE::split //, $_[3] to CORE::split(\, $_[3])
  - fix lib/UTF8/R2.pm: tr/// in error strings changed to tr range
  - fix lib/UTF8/R2.pm: join(\,$x) changed to join(\, $x)
  - fix lib/UTF8/R2.pm: (caller)[0,2,1] changed to (caller)[0, 2, 1]
  - fix lib/UTF8/R2.pm: remove whitespace-only lines in POD verbatim blocks
    (Pod::Checker warnings=0 achieved)
  - fix README: add INSTALLATION, AUTHOR, LICENSE AND COPYRIGHT sections
  - fix META.yml, META.json, Makefile.PL: version 0.28 -> 0.29
  - fix t/9040-style.t: exempt \\%mb from K3 check (tied hash requires ref)
  - created by INABA Hitoshi

0.28  2023-03-23 00:00:00
  - add t/8101_mb_package.t
  - created by INABA Hitoshi

lib/UTF8/R2.pm  view on Meta::CPAN

        $number = int($number / 0x100);
    } while ($number > 0);
    return pack 'C*', @octet;
}

#---------------------------------------------------------------------
# mb::do() like do(), mb.pm compatible
sub UTF8::R2::do ($) {

    # run as Perl script
    return CORE::eval sprintf(<<'END', (caller)[0, 2, 1]);
package %s;
#line %s "%s"
CORE::do "$_[0]";
END
}

#---------------------------------------------------------------------
# mb::eval() like eval(), mb.pm compatible
sub UTF8::R2::eval (;$) {
    local $_ = @_ ? $_[0] : $_;

    # run as Perl script in caller package
    return CORE::eval sprintf(<<'END', (caller)[0, 2, 1], $_);
package %s;
#line %s "%s"
%s
END
}

#---------------------------------------------------------------------
# getc() for UTF-8 codepoint string
sub UTF8::R2::getc (;*) {
    my $fh = @_ ? Symbol::qualify_to_ref($_[0], caller()) : \*STDIN;

lib/UTF8/R2.pm  view on Meta::CPAN

            return 1 if $INC{$file};
            confess "Compilation failed in require";
        }
        for my $prefix_file ($file, map { "$_/$file" } @INC) {
            if (-f $prefix_file) {
                $INC{$_} = $prefix_file;

                # run as Perl script
                # must use CORE::do to use <DATA>, because CORE::eval cannot do it.
                local $@;
                my $result = CORE::eval sprintf(<<'END', (caller)[0, 2, 1]);
package %s;
#line %s "%s"
CORE::do "$prefix_file";
END

                # return result
                if ($@) {
                    $INC{$_} = undef;
                    confess $@;
                }



( run in 2.051 seconds using v1.01-cache-2.11-cpan-99c4e6809bf )