INABA Hitoshi > Char-UHC-0.92 > UHC



Annotate this POD

View/Report Bugs
Module Version: 0.92   Source   Latest Release: Char-UHC-0.95


UHC - Source code filter to escape UHC script

Install and Usage ^

There are two steps there:


  use UHC;
  use UHC ver.sion;             --- require minimum version
  use UHC ver.sion.0;           --- expects version (match or die)
  use UHC qw(ord reverse getc); --- demand enhanced feature of ord, reverse, and getc
  use UHC ver.sion qw(ord reverse getc);
  use UHC ver.sion.0 qw(ord reverse getc);

  # "no UHC;" not supported


  $ perl >


  $ perl  --- script written in UHC --- escaped script


  emulate Perl5.6 on perl5.00503
    use warnings;
    use warnings::register;

  emulate Perl5.16
    use feature qw(fc);

  dummy functions:


UHC software is "middleware" between perl interpreter and your Perl script written in UHC.

Perl is optimized for problems which are about 90% working with text and about 10% everything else. Even if this "text" doesn't contain UHC, Perl3 or later can treat UHC as binary data.

By "use UHC;", it automatically interpret your script as UHC. The various functions of perl including a regular expression can treat UHC now. The function length treats length per byte. This software does not use UTF8 flag.

Yet Another Future Of ^

JPerl is very useful software. -- Oops, note, this "JPerl" means "Japanized Perl" or "Japanese Perl". Therefore, it is unrelated to JPerl of the following.

 JPerl is an implementation of Perl written in Java.
 jPerl - Perl on the JVM
 Jamie's PERL scripts for bioinformatics
 jperl (Jonathan Perl)

Now, the last version of JPerl is 5.005_04 and is not maintained now.

Japanization modifier WATANABE Hirofumi said,

  "Because WATANABE am tired I give over maintaing JPerl."

at Slide #15: "The future of JPerl" of

in The Perl Confernce Japan 1998.

When I heard it, I thought that someone excluding me would maintain JPerl. And I slept every night hanging a sock. Night and day, I kept having hope. After 10 years, I noticed that white beard exists in the sock :-)

This software is a source code filter to escape Perl script encoded by UHC given from STDIN or command line parameter. The character code is never converted by escaping the script. Neither the value of the character nor the length of the character string change even if it escapes.

I learned the following things from the successful software.

I am excited about this software and Perl's future --- I hope you are too.

JRE: JPerl Runtime Environment ^

  |        JPerl Application Script       | Your Script
  |  Source Code Filter, Runtime Routine  | ex.,
  |          PVM 5.00503 or later         | ex. perl 5.00503

A Perl Virtual Machine (PVM) enables a set of computer software programs and data structures to use a virtual machine model for the execution of other computer programs and scripts. The model used by a PVM accepts a form of computer intermediate language commonly referred to as Perl byteorientedcode. This language conceptually represents the instruction set of a byte-oriented, capability architecture.

Basic Idea of Source Code Filter ^

I discovered this mail again recently.

[] jus Benkyoukai

save as:

  package SJIS;
  use Filter::Util::Call;
  sub multibyte_filter {
      my $status;
      if (($status = filter_read()) > 0 ) {
  sub import {

I am glad that I could confirm my idea is not so wrong.

Command-line Wildcard Expansion on DOS-like Systems ^

The default command shells on DOS-like systems (COMMAND.COM or cmd.exe) do not expand wildcard arguments supplied to programs. Instead, import of works well.

   # @ARGV wildcard globbing
   sub import {

       if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/oxms) {
           my @argv = ();
           for (@ARGV) {

               # has space
               if (/\A (?:$q_char)*? [ ] /oxms) {
                   if (my @glob = Euhc::glob(qq{"$_"})) {
                       push @argv, @glob;
                   else {
                       push @argv, $_;

               # has wildcard metachar
               elsif (/\A (?:$q_char)*? [*?] /oxms) {
                   if (my @glob = Euhc::glob($_)) {
                       push @argv, @glob;
                   else {
                       push @argv, $_;

               # no wildcard globbing
               else {
                   push @argv, $_;
           @ARGV = @argv;

Software Composition ^               --- source code filter to escape UHC              --- run-time routines for
   perl5.bat             --- find and run perl5    without %PATH% settings
   perl55.bat            --- find and run perl5.5  without %PATH% settings
   perl56.bat            --- find and run perl5.6  without %PATH% settings
   perl58.bat            --- find and run perl5.8  without %PATH% settings
   perl510.bat           --- find and run perl5.10 without %PATH% settings
   perl512.bat           --- find and run perl5.12 without %PATH% settings
   perl514.bat           --- find and run perl5.14 without %PATH% settings
   perl516.bat           --- find and run perl5.16 without %PATH% settings
   perl518.bat           --- find and run perl5.18 without %PATH% settings
   perl64.bat            --- find and run perl64   without %PATH% settings
   perl64512.bat         --- find and run perl5.12 (x64) without %PATH% settings
   perl64514.bat         --- find and run perl5.14 (x64) without %PATH% settings
   perl64516.bat         --- find and run perl5.16 (x64) without %PATH% settings
   perl64518.bat         --- find and run perl5.18 (x64) without %PATH% settings
   aperl58.bat           --- find and run ActivePerl 5.8  without %PATH% settings
   aperl510.bat          --- find and run ActivePerl 5.10 without %PATH% settings
   aperl512.bat          --- find and run ActivePerl 5.12 without %PATH% settings
   aperl514.bat          --- find and run ActivePerl 5.14 without %PATH% settings
   aperl516.bat          --- find and run ActivePerl 5.16 without %PATH% settings
   aperl518.bat          --- find and run ActivePerl 5.18 without %PATH% settings
   aperl64512.bat        --- find and run ActivePerl 5.12 (x64) without %PATH% settings
   aperl64514.bat        --- find and run ActivePerl 5.14 (x64) without %PATH% settings
   aperl64516.bat        --- find and run ActivePerl 5.16 (x64) without %PATH% settings
   aperl64518.bat        --- find and run ActivePerl 5.18 (x64) without %PATH% settings
   sperl58.bat           --- find and run Strawberry Perl 5.8  without %PATH% settings
   sperl510.bat          --- find and run Strawberry Perl 5.10 without %PATH% settings
   sperl512.bat          --- find and run Strawberry Perl 5.12 without %PATH% settings
   sperl514.bat          --- find and run Strawberry Perl 5.14 without %PATH% settings
   sperl516.bat          --- find and run Strawberry Perl 5.16 without %PATH% settings
   sperl518.bat          --- find and run Strawberry Perl 5.18 without %PATH% settings
   sperl64512.bat        --- find and run Strawberry Perl 5.12 (x64) without %PATH% settings
   sperl64514.bat        --- find and run Strawberry Perl 5.14 (x64) without %PATH% settings
   sperl64516.bat        --- find and run Strawberry Perl 5.16 (x64) without %PATH% settings
   sperl64518.bat        --- find and run Strawberry Perl 5.18 (x64) without %PATH% settings
   cperl.bat             --- find and run Cygwin's Perl without %PATH% settings
   strict.pm_            --- dummy
   warnings.pm_          --- poor
   warnings/register.pm_ --- poor warnings/
   feature.pm_           --- dummy

Upper Compatibility by Escaping ^

This software adds the function by 'Escaping' it always, and nothing of the past is broken. Therefore, 'Possible job' never becomes 'Impossible job'. This approach is effective in the field where the retreat is never permitted. It means incompatible upgrade of Perl should be rewound.

Escaping Your Script (You do) ^

You need write 'use UHC;' in your script.

  Before      You do
  (nothing)   use UHC;

Escaping Multiple-Octet Code ( provides) ^

Insert chr(0x5c) before @ [ \ ] ^ ` { | and } in multiple-octet of

  ex. Japanese Katakana "SO" like [ `/ ] code is "\x83\x5C" in SJIS
                  see     hex dump
  source script   "`/"    [83 5c]
  Here, use SJIS;
                          hex dump
  escaped script  "`\/"   [83 [5c] 5c]
                    ^--- escape by SJIS software
  by the by       see     hex dump
  your eye's      "`/\"   [83 5c] [5c]
  perl eye's      "`\/"   [83] \[5c]
                          hex dump
  in the perl     "`/"    [83] [5c]

Multiple-Octet Anchoring of Regular Expression ( provides) ^ applies multiple-octet anchoring at beginning of regular expression.

  Before                  After
  m/regexp/               m/${Euhc::anchor}(?:regexp).../

Escaping Second Octet ( provides) ^ escapes second octet of multiple-octet character in regular expression.

  Before                  After
  m<...`/...>             m<...`/\...>

Multiple-Octet Character Regular Expression ( provides) ^ clusters multiple-octet character with quantifier, makes cluster from multiple-octet custom character classes. And makes multiple-octet version metasymbol from classic Perl character class shortcuts and POSIX-style character classes.

  Before                  After
  m/...MULTIOCT+.../      m/...(?:MULTIOCT)+.../
  m/...[AN-EM].../        m/...(?:A[N-Z]|[B-D][A-Z]|E[A-M]).../
  m/...\D.../             m/...(?:${Euhc::eD}).../
  m/...[[:^digit:]].../   m/...(?:${Euhc::not_digit}).../

Calling 'Euhc::ignorecase()' ( provides) ^ applies calling 'Euhc::ignorecase()' instead of /i modifier.

  Before                  After
  m/...$var.../i          m/...@{[Euhc::ignorecase($var)]}.../

Character-Oriented Regular Expression ^

Regular expression works as character-oriented that has no /b modifier.

  Before                  After
  /regexp/                /ditto$Euhc::matched/
  m/regexp/               m/ditto$Euhc::matched/
  ?regexp?                m?ditto$Euhc::matched?
  m?regexp?               m?ditto$Euhc::matched?
  $_ =~                   ($_ =~ m/ditto$Euhc::matched/) ?
  s/regexp/replacement/   eval{ Euhc::s_matched(); local $^W=0; my $__r=qq/replacement/; $_="${1}$__r$'"; 1 } :
  $_ !~                   ($_ !~ m/ditto$Euhc::matched/) ?
  s/regexp/replacement/   1 :
                          eval{ Euhc::s_matched(); local $^W=0; my $__r=qq/replacement/; $_="${1}$__r$'"; undef }
  split(/regexp/)         Euhc::split(qr/regexp/)
  split(m/regexp/)        Euhc::split(qr/regexp/)
  split(qr/regexp/)       Euhc::split(qr/regexp/)
  qr/regexp/              qr/ditto$Euhc::matched/

Byte-Oriented Regular Expression ^

Regular expression works as byte-oriented that has /b modifier.

  Before                  After
  /regexp/b               /(?:regexp)$Euhc::matched/
  m/regexp/b              m/(?:regexp)$Euhc::matched/
  ?regexp?b               m?regexp$Euhc::matched?
  m?regexp?b              m?regexp$Euhc::matched?
  $_ =~                   ($_ =~ m/(\G[\x00-\xFF]*?)(?:regexp)$Euhc::matched/) ?
  s/regexp/replacement/b  eval{ Euhc::s_matched(); local $^W=0; my $__r=qq/replacement/; $_="${1}$__r$'"; 1 } :
  $_ !~                   ($_ !~ m/(\G[\x00-\xFF]*?)(?:regexp)$Euhc::matched/) ?
  s/regexp/replacement/b  1 :
                          eval{ Euhc::s_matched(); local $^W=0; my $__r=qq/replacement/; $_="${1}$__r$'"; undef }
  split(/regexp/b)        split(qr/regexp/)
  split(m/regexp/b)       split(qr/regexp/)
  split(qr/regexp/b)      split(qr/regexp/)
  qr/regexp/b             qr/(?:regexp)$Euhc::matched/

Escaping Character Classes ( provides) ^

The character classes are redefined as follows to backward compatibility.

  Before        After
   .            ${Euhc::dot}
                ${Euhc::dot_s}    (/s modifier)
  \d            [0-9]
  \s            \s
  \w            [0-9A-Z_a-z]
  \D            ${Euhc::eD}
  \S            ${Euhc::eS}
  \W            ${Euhc::eW}
  \h            [\x09\x20]
  \v            [\x0A\x0B\x0C\x0D]
  \H            ${Euhc::eH}
  \V            ${Euhc::eV}
  \C            [\x00-\xFF]
  \X            X (so, just 'X')
  \R            ${Euhc::eR}
  \N            ${Euhc::eN}

Also POSIX-style character classes.

  Before        After
  [:alnum:]     [\x30-\x39\x41-\x5A\x61-\x7A]
  [:alpha:]     [\x41-\x5A\x61-\x7A]
  [:ascii:]     [\x00-\x7F]
  [:blank:]     [\x09\x20]
  [:cntrl:]     [\x00-\x1F\x7F]
  [:digit:]     [\x30-\x39]
  [:graph:]     [\x21-\x7F]
  [:lower:]     [\x61-\x7A]
                [\x41-\x5A\x61-\x7A]     (/i modifier)
  [:print:]     [\x20-\x7F]
  [:punct:]     [\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E]
  [:space:]     [\s\x0B]
  [:upper:]     [\x41-\x5A]
                [\x41-\x5A\x61-\x7A]     (/i modifier)
  [:word:]      [\x30-\x39\x41-\x5A\x5F\x61-\x7A]
  [:xdigit:]    [\x30-\x39\x41-\x46\x61-\x66]
  [:^alnum:]    ${Euhc::not_alnum}
  [:^alpha:]    ${Euhc::not_alpha}
  [:^ascii:]    ${Euhc::not_ascii}
  [:^blank:]    ${Euhc::not_blank}
  [:^cntrl:]    ${Euhc::not_cntrl}
  [:^digit:]    ${Euhc::not_digit}
  [:^graph:]    ${Euhc::not_graph}
  [:^lower:]    ${Euhc::not_lower}
                ${Euhc::not_lower_i}    (/i modifier)
  [:^print:]    ${Euhc::not_print}
  [:^punct:]    ${Euhc::not_punct}
  [:^space:]    ${Euhc::not_space}
  [:^upper:]    ${Euhc::not_upper}
                ${Euhc::not_upper_i}    (/i modifier)
  [:^word:]     ${Euhc::not_word}
  [:^xdigit:]   ${Euhc::not_xdigit}

\b and \B are redefined as follows to backward compatibility.

  Before      After
  \b          ${Euhc::eb}
  \B          ${Euhc::eB}

Definitions in

  After                    Definition
  ${Euhc::anchor}         qr{\G(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE])*?}
                           for over 32766 octets string on ActivePerl5.6 and Perl5.10 or later
  ${Euhc::dot}            qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE\x0A])}
  ${Euhc::dot_s}          qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE])}
  ${Euhc::eD}             qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE0-9])}
  ${Euhc::eS}             qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE\s])}
  ${Euhc::eW}             qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE0-9A-Z_a-z])}
  ${Euhc::eH}             qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE\x09\x20])}
  ${Euhc::eV}             qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE\x0A\x0B\x0C\x0D])}
  ${Euhc::eR}             qr{(?:\x0D\x0A|[\x0A\x0D])}
  ${Euhc::eN}             qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE\x0A])}
  ${Euhc::not_alnum}      qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE\x30-\x39\x41-\x5A\x61-\x7A])}
  ${Euhc::not_alpha}      qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE\x41-\x5A\x61-\x7A])}
  ${Euhc::not_ascii}      qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE\x00-\x7F])}
  ${Euhc::not_blank}      qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE\x09\x20])}
  ${Euhc::not_cntrl}      qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE\x00-\x1F\x7F])}
  ${Euhc::not_digit}      qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE\x30-\x39])}
  ${Euhc::not_graph}      qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE\x21-\x7F])}
  ${Euhc::not_lower}      qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE\x61-\x7A])}
  ${Euhc::not_lower_i}    qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE])}
  ${Euhc::not_print}      qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE\x20-\x7F])}
  ${Euhc::not_punct}      qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E])}
  ${Euhc::not_space}      qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE\s\x0B])}
  ${Euhc::not_upper}      qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE\x41-\x5A])}
  ${Euhc::not_upper_i}    qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE])}
  ${Euhc::not_word}       qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE\x30-\x39\x41-\x5A\x5F\x61-\x7A])}
  ${Euhc::not_xdigit}     qr{(?:[\x81-\xFE][\x00-\xFF]|[^\x81-\xFE\x30-\x39\x41-\x46\x61-\x66])}
  ${Euhc::eb}             qr{(?:\A(?=[0-9A-Z_a-z])|(?<=[\x00-\x2F\x40\x5B-\x5E\x60\x7B-\xFF])(?=[0-9A-Z_a-z])|(?<=[0-9A-Z_a-z])(?=[\x00-\x2F\x40\x5B-\x5E\x60\x7B-\xFF]|\z))}
  ${Euhc::eB}             qr{(?:(?<=[0-9A-Z_a-z])(?=[0-9A-Z_a-z])|(?<=[\x00-\x2F\x40\x5B-\x5E\x60\x7B-\xFF])(?=[\x00-\x2F\x40\x5B-\x5E\x60\x7B-\xFF]))}

Un-Escaping \ of \N, \p, \P and \X ( provides) ^ removes '\' at head of alphanumeric regexp metasymbols \N, \p, \P and \X. By this method, you can avoid the trap of the abstraction.

See also, Deprecate literal unescaped "{" in regexes.

  Before           After
  \p{L}            p\{L}
  \p{^L}           p\{^L}
  \p{\^L}          p\{\^L}
  \pL              pL
  \P{L}            P\{L}
  \P{^L}           P\{^L}
  \P{\^L}          P\{\^L}
  \PL              PL
  \X               X

Escaping Built-in Functions ( and provide) ^

Insert 'Euhc::' at head of function name. provides your script Euhc::* subroutines.

  Before      After            Works as
  length      length           Byte
  substr      substr           Byte
  pos         pos              Byte
  split       Euhc::split     Character
  tr///       Euhc::tr        Character
  tr///b      tr///            Byte
  tr///B      tr///            Byte
  y///        Euhc::tr        Character
  y///b       tr///            Byte
  y///B       tr///            Byte
  chop        Euhc::chop      Character
  index       Euhc::index     Character
  rindex      Euhc::rindex    Character
  lc          Euhc::lc        Character
  lcfirst     Euhc::lcfirst   Character
  uc          Euhc::uc        Character
  ucfirst     Euhc::ucfirst   Character
  fc          Euhc::fc        Character
  chr         Euhc::chr       Character
  glob        Euhc::glob      Character
  lstat       Euhc::lstat     Character
  opendir     Euhc::opendir   Character
  stat        Euhc::stat      Character
  unlink      Euhc::unlink    Character
  chdir       Euhc::chdir     Character
  do          Euhc::do        Character
  require     Euhc::require   Character

  Before                   After
  use Perl::Module;        BEGIN { Euhc::require 'Perl/'; Perl::Module->import() if Perl::Module->can('import'); }
  use Perl::Module @list;  BEGIN { Euhc::require 'Perl/'; Perl::Module->import(@list) if Perl::Module->can('import'); }
  use Perl::Module ();     BEGIN { Euhc::require 'Perl/'; }
  no Perl::Module;         BEGIN { Euhc::require 'Perl/'; Perl::Module->unimport() if Perl::Module->can('unimport'); }
  no Perl::Module @list;   BEGIN { Euhc::require 'Perl/'; Perl::Module->unimport(@list) if Perl::Module->can('unimport'); }
  no Perl::Module ();      BEGIN { Euhc::require 'Perl/'; }

Escaping File Test Operators ( and provide) ^

Insert 'Euhc::' instead of '-' of operator.

  Available in MSWin32, MacOS, and UNIX-like systems
  Before   After      Meaning
  -r       Euhc::r   File or directory is readable by this (effective) user or group
  -w       Euhc::w   File or directory is writable by this (effective) user or group
  -e       Euhc::e   File or directory name exists
  -x       Euhc::x   File or directory is executable by this (effective) user or group
  -z       Euhc::z   File exists and has zero size (always false for directories)
  -f       Euhc::f   Entry is a plain file
  -d       Euhc::d   Entry is a directory
  -t       -t         The filehandle is a TTY (as reported by the isatty() system function;
                      filenames can't be tested by this test)
  -T       Euhc::T   File looks like a "text" file
  -B       Euhc::B   File looks like a "binary" file
  -M       Euhc::M   Modification age (measured in days)
  -A       Euhc::A   Access age (measured in days)
  -C       Euhc::C   Inode-modification age (measured in days)
  -s       Euhc::s   File or directory exists and has nonzero size
                      (the value is the size in bytes)
  Available in MacOS and UNIX-like systems
  Before   After      Meaning
  -R       Euhc::R   File or directory is readable by this real user or group
  -W       Euhc::W   File or directory is writable by this real user or group
  -X       Euhc::X   File or directory is executable by this real user or group
  -l       Euhc::l   Entry is a symbolic link
  -S       Euhc::S   Entry is a socket
  Not available in MSWin32 and MacOS
  Before   After      Meaning
  -o       Euhc::o   File or directory is owned by this (effective) user
  -O       Euhc::O   File or directory is owned by this real user
  -p       Euhc::p   Entry is a named pipe (a "fifo")
  -b       Euhc::b   Entry is a block-special file (like a mountable disk)
  -c       Euhc::c   Entry is a character-special file (like an I/O device)
  -u       Euhc::u   File or directory is setuid
  -g       Euhc::g   File or directory is setgid
  -k       Euhc::k   File or directory has the sticky bit set

-w only inspects the read-only file attribute (FILE_ATTRIBUTE_READONLY), which determines whether the directory can be deleted, not whether it can be written to. Directories always have read and write access unless denied by discretionary access control lists (DACLs). (MSWin32) -R, -W, -X, -O are indistinguishable from -r, -w, -x, -o. (MSWin32) -g, -k, -l, -u, -A are not particularly meaningful. (MSWin32) -x (or -X) determine if a file ends in one of the executable suffixes. -S is meaningless. (MSWin32)

As of Perl 5.00503, as a form of purely syntactic sugar, you can stack file test operators, in a way that -w -x $file is equivalent to -x $file && -w _ .

  if ( -w -r $file ) {
      print "The file is both readable and writable!\n";

Escaping Function Name (You do) ^

You need write 'UHC::' at head of function name when you want character- oriented subroutine. See 'Character-Oriented Subroutines'.

  Function   Character-Oriented   Description
  ord        UHC::ord
  reverse    UHC::reverse
  getc       UHC::getc
  length     UHC::length
  substr     UHC::substr
  index      UHC::index          See 'About Indexes'
  rindex     UHC::rindex         See 'About Rindexes'

  About Indexes
  Function       Works as    Returns as   Description
  index          Character   Byte         JPerl semantics (most useful)
  (same as Euhc::index)
  UHC::index    Character   Character    Character-oriented semantics
  CORE::index    Byte        Byte         Byte-oriented semantics
  (nothing)      Byte        Character    (most useless)

  About Rindexes
  Function       Works as    Returns as   Description
  rindex         Character   Byte         JPerl semantics (most useful)
  (same as Euhc::rindex)
  UHC::rindex   Character   Character    Character-oriented semantics
  CORE::rindex   Byte        Byte         Byte-oriented semantics
  (nothing)      Byte        Character    (most useless)

Character-Oriented Subsroutines ^

Byte-Oriented Functions ^

Un-Escaping bytes::* Subroutines ( provides) ^ removes 'bytes::' at head of subroutine name.

  Before           After     Works as
  bytes::chr       chr       Byte
  bytes::index     index     Byte
  bytes::length    length    Byte
  bytes::ord       ord       Byte
  bytes::rindex    rindex    Byte
  bytes::substr    substr    Byte

Escaping Standard Module Content (You do) ^

You need copy built-in standard module to /Perl/site/lib/UHC and change 'use utf8;' to 'use UHC;' in its. You need help yourself for now.

Back to and see 'Escaping Your Script'. Enjoy hacking!!

Ignore Pragmas and Modules ^

  Before                    After
  use strict;               use strict; no strict qw(refs);
  use 5.12.0;               use 5.12.0; no strict qw(refs);
  require utf8;             # require utf8;
  require bytes;            # require bytes;
  require charnames;        # require charnames;
  require I18N::Japanese;   # require I18N::Japanese;
  require I18N::Collate;    # require I18N::Collate;
  require I18N::JExt;       # require I18N::JExt;
  require File::DosGlob;    # require File::DosGlob;
  require Wild;             # require Wild;
  require Wildcard;         # require Wildcard;
  require Japanese;         # require Japanese;
  use utf8;                 # use utf8;
  use bytes;                # use bytes;
  use charnames;            # use charnames;
  use I18N::Japanese;       # use I18N::Japanese;
  use I18N::Collate;        # use I18N::Collate;
  use I18N::JExt;           # use I18N::JExt;
  use File::DosGlob;        # use File::DosGlob;
  use Wild;                 # use Wild;
  use Wildcard;             # use Wildcard;
  use Japanese;             # use Japanese;
  no utf8;                  # no utf8;
  no bytes;                 # no bytes;
  no charnames;             # no charnames;
  no I18N::Japanese;        # no I18N::Japanese;
  no I18N::Collate;         # no I18N::Collate;
  no I18N::JExt;            # no I18N::JExt;
  no File::DosGlob;         # no File::DosGlob;
  no Wild;                  # no Wild;
  no Wildcard;              # no Wildcard;
  no Japanese;              # no Japanese;

  Comment out pragma to ignore utf8 environment, and provides these

Environment Variable ^

 This software uses the flock function for exclusive control. The execution of the
 program is blocked until it becomes possible to read or write the file.
 You can have it not block in the flock function by defining environment variable
 (The value '1' doesn't have the meaning)

Perl5.6 Emulation on perl5.005 ^

  Using warnings pragma on perl5.00503 by rename files.

  warnings.pm_ -->
  warnings/register.pm_ --> warnings/

Perl5.16 Emulation ^

  Using feature pragma by rename files.

  feature.pm_ -->


I have tested and verified this software using the best of my ability. However, a software containing much regular expression is bound to contain some bugs. Thus, if you happen to find a bug that's in UHC software and not your own program, you can try to reduce it to a minimal test case and then report it to the following author's address. If you have an idea that could make this a more useful tool, please let everyone share it.


INABA Hitoshi <>

This project was originated by INABA Hitoshi.


This software is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See 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.

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.

  Information processing model beginning with perl 5.8
    |     Text strings     |                     |
    +----------+-----------|    Binary strings   |
    |   UTF8   |  Latin-1  |                     |
    | UTF8     |            Not UTF8             |
    | Flagged  |            Flagged              |
    You should memorize this figure.
    (Why is only Latin-1 special?)

This change consequentially made a big gap between a past script and new script. Both scripts cannot re-use the code mutually any longer. Because a new method puts a strain in the programmer, it will still take time to replace all the in existence scripts.

The biggest problem of new method is that the UTF8 flag can't synchronize to real encode of string. Thus you must debug about UTF8 flag, before your script. How to solve it by returning to a this method, let's drag out page 402 of the old dusty Programming Perl, 3rd ed. again.

  Information processing model beginning with perl3 or this software.

    |       Text strings as Binary strings       |
    |       Binary strings as Text strings       |
    |              Not UTF8 Flagged              |

Ideally, I'd like to achieve these five Goals:

Back when Programming Perl, 3rd ed. was written, UTF8 flag was not born and Perl is designed to make the easy jobs easy. This software provide programming environment like at that time.

Words of Learning Perl ^

   Some computer scientists (the reductionists, in particular) would
  like to deny it, but people have funny-shaped minds. Mental geography
  is not linear, and cannot be mapped onto a flat surface without
  severe distortion. But for the last score years or so, computer
  reductionists have been first bowing down at the Temple of Orthogonality,
  then rising up to preach their ideas of ascetic rectitude to any who
  would listen.
   Their fervent but misguided desire was simply to squash your mind to
  fit their mindset, to smush your patterns of thought into some sort of
  Hyperdimensional Flatland. It's a joyless existence, being smushed.
  --- Learning Perl on Win32 Systems
  If you think this is a big headache, you're right. No one likes
  this situation, but Perl does the best it can with the input and
  encodings it has to deal with. If only we could reset history and
  not make so many mistakes next time.
  --- Learning Perl 6th Edition


 Larry Wall, Randal L.Schwartz, Yoshiyuki Kondo
 December 1997
 ISBN 4-89052-384-7

 Programming Perl, Second Edition
 By Larry Wall, Tom Christiansen, Randal L. Schwartz
 October 1996
 Pages: 670
 ISBN 10: 1-56592-149-6 | ISBN 13: 9781565921498

 Programming Perl, Third Edition
 By Larry Wall, Tom Christiansen, Jon Orwant
 Third Edition  July 2000
 Pages: 1104
 ISBN 10: 0-596-00027-8 | ISBN 13: 9780596000271

 The Perl Language Reference Manual (for Perl version 5.12.1)
 by Larry Wall and others
 Paperback (6"x9"), 724 pages
 Retail Price: $39.95 (pound 29.95 in UK)
 ISBN-13: 978-1-906966-02-7

 Perl Pocket Reference, 5th Edition
 By Johan Vromans
 Publisher: O'Reilly Media
 Released: July 2011
 Pages: 102

 Programming Perl, 4th Edition
 By: Tom Christiansen, brian d foy, Larry Wall, Jon Orwant
 Publisher: O'Reilly Media
 Formats: Print, Ebook, Safari Books Online
 Released: March 2012
 Pages: 1130
 Print ISBN: 978-0-596-00492-7 | ISBN 10: 0-596-00492-3
 Ebook ISBN: 978-1-4493-9890-3 | ISBN 10: 1-4493-9890-1

 Perl Cookbook, Second Edition
 By Tom Christiansen, Nathan Torkington
 Second Edition  August 2003
 Pages: 964
 ISBN 10: 0-596-00313-7 | ISBN 13: 9780596003135

 Perl in a Nutshell, Second Edition
 By Stephen Spainhour, Ellen Siever, Nathan Patwardhan
 Second Edition  June 2002
 Pages: 760
 Series: In a Nutshell
 ISBN 10: 0-596-00241-6 | ISBN 13: 9780596002411

 Learning Perl on Win32 Systems
 By Randal L. Schwartz, Erik Olson, Tom Christiansen
 August 1997
 Pages: 306
 ISBN 10: 1-56592-324-3 | ISBN 13: 9781565923249

 Learning Perl, Fifth Edition
 By Randal L. Schwartz, Tom Phoenix, brian d foy
 June 2008
 Pages: 352
 Print ISBN:978-0-596-52010-6 | ISBN 10: 0-596-52010-7
 Ebook ISBN:978-0-596-10316-3 | ISBN 10: 0-596-10316-6

 Learning Perl, 6th Edition
 By Randal L. Schwartz, brian d foy, Tom Phoenix
 June 2011
 Pages: 390
 ISBN-10: 1449303587 | ISBN-13: 978-1449303587

 Futato, Irving, Jepson, Patwardhan, Siever
 ISBN 10: 1-56592-370-7

 By Daisuke Maki
 Pages: 344
 ISBN 10: 4798119172 | ISBN 13: 978-4798119175

 Understanding Japanese Information Processing
 By Ken Lunde
 January 1900
 Pages: 470
 ISBN 10: 1-56592-043-0 | ISBN 13: 9781565920439

 CJKV Information Processing
 Chinese, Japanese, Korean & Vietnamese Computing
 By Ken Lunde
 First Edition  January 1999
 Pages: 1128
 ISBN 10: 1-56592-224-7 | ISBN 13: 9781565922242

 Mastering Regular Expressions, Second Edition
 By Jeffrey E. F. Friedl
 Second Edition  July 2002
 Pages: 484
 ISBN 10: 0-596-00289-0 | ISBN 13: 9780596002893

 Mastering Regular Expressions, Third Edition
 By Jeffrey E. F. Friedl
 Third Edition  August 2006
 Pages: 542
 ISBN 10: 0-596-52812-4 | ISBN 13:9780596528126

 Regular Expressions Cookbook
 By Jan Goyvaerts, Steven Levithan
 May 2009
 Pages: 512
 ISBN 10:0-596-52068-9 | ISBN 13: 978-0-596-52068-7

 By Kouji Shibano
 Pages: 1456
 ISBN 4-542-20129-5

 1993 Aug
 Pages: 172
 T1008901080816 ZASSHI 08901-8

 By YAMAGATA Hiroo, Stephen J. Turnbull, Craig Oda, Robert J. Bickel
 June, 2000
 Pages: 376
 ISBN 4-87311-016-5

 MacPerl Power and Ease
 By Vicki Brown, Chris Nandor
 April 1998
 Pages: 350
 ISBN 10: 1881957322 | ISBN 13: 978-1881957324

 Windows NT Shell Scripting
 By Timothy Hill
 April 27, 1998
 Pages: 400
 ISBN 10: 1578700477 | ISBN 13: 9781578700479

 Windows(R) Command-Line Administrators Pocket Consultant, 2nd Edition
 By William R. Stanek
 February 2009
 Pages: 594
 ISBN 10: 0-7356-2262-0 | ISBN 13: 978-0-7356-2262-3

 Other Tools



This software was made referring to software and the document that the following hackers or persons had made. I am thankful to all persons.

 Rick Yamashita, Shift_JIS
 ttp://!1pmWgsL289nm7Shn7cS0jHzA!2225.entry (dead link)
 (add 'h' at head)

 Larry Wall, Perl

 Kazumasa Utashiro,

 Jeffrey E. F. Friedl, Mastering Regular Expressions

 SADAHIRO Tomoyuki, The right way of using Shift_JIS

 Yukihiro "Matz" Matsumoto, YAPC::Asia2006 Ruby on Perl(s)

 jscripter, For jperl users

 Bruce., Unicode in Perl

 Hiroaki Izumi, Perl5.8/Perl5.10 is not useful on the Windows.

 TSUKAMOTO Makio, Perl memo/file path of Windows

 chaichanPaPa, Matching Shift_JIS file name

 SUZUKI Norio, Jperl

 WATANABE Hirofumi, Jperl

 Chuck Houpt, Michiko Nozu, MacJPerl

 Kenichi Ishigaki, Pod-PerldocJp, Welcome to modern Perl world

 Fuji, Goro (gfx), Perl Hackers Hub No.16

 Dan Kogai, Encode module (video) (audio)

 Juerd, Perl Unicode Advice

 daily dayflower, 2008-06-25 perluniadvice

 Jesse Vincent, Compatibility is a virtue

 Tokyo-pm archive

syntax highlighting: