HP15 software is "middleware" between perl interpreter and your Perl script written in HP-15.

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

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

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 HP-15 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.

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.

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.

HP15 software 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.

Available in MSWin32, MacOS, and UNIX-like systems
--------------------------------------------------------------------------
Before After Meaning
--------------------------------------------------------------------------
-r Ehp15::r File or directory is readable by this (effective) user or group
-w Ehp15::w File or directory is writable by this (effective) user or group
-e Ehp15::e File or directory name exists
-x Ehp15::x File or directory is executable by this (effective) user or group
-z Ehp15::z File exists and has zero size (always false for directories)
-f Ehp15::f Entry is a plain file
-d Ehp15::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 Ehp15::T File looks like a "text" file
-B Ehp15::B File looks like a "binary" file
-M Ehp15::M Modification age (measured in days)
-A Ehp15::A Access age (measured in days)
-C Ehp15::C Inode-modification age (measured in days)
-s Ehp15::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 Ehp15::R File or directory is readable by this real user or group
-W Ehp15::W File or directory is writable by this real user or group
-X Ehp15::X File or directory is executable by this real user or group
-l Ehp15::l Entry is a symbolic link
-S Ehp15::S Entry is a socket
--------------------------------------------------------------------------
Not available in MSWin32 and MacOS
--------------------------------------------------------------------------
Before After Meaning
--------------------------------------------------------------------------
-o Ehp15::o File or directory is owned by this (effective) user
-O Ehp15::O File or directory is owned by this real user
-p Ehp15::p Entry is a named pipe (a "fifo")
-b Ehp15::b Entry is a block-special file (like a mountable disk)
-c Ehp15::c Entry is a character-special file (like an I/O device)
-u Ehp15::u File or directory is setuid
-g Ehp15::g File or directory is setgid
-k Ehp15::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";
}

$ord = HP15::ord($string);
This subroutine returns the numeric value (ASCII or HP-15 character) of the
first character of $string, not Unicode. If $string is omitted, it uses $_.
The return value is always unsigned.
If you import ord "use HP15 qw(ord);", ord of your script will be rewritten in
HP15::ord. HP15::ord is not compatible with ord of JPerl.

Reverse List or String

@reverse = HP15::reverse(@list);
$reverse = HP15::reverse(@list);
In list context, this subroutine returns a list value consisting of the elements
of @list in the opposite order.
In scalar context, the subroutine concatenates all the elements of @list and
then returns the reverse of that resulting string, character by character.
If you import reverse "use HP15 qw(reverse);", reverse of your script will be
rewritten in HP15::reverse. HP15::reverse is not compatible with reverse of
JPerl.
Even if you do not know this subroutine, there is no problem. This subroutine
can be created with
$rev = join('', reverse(split(//, $jstring)));
as before.
See:
P.558 JPerl (Japanese Perl)
Appendix C Supplement the Japanese version
ISBN 4-89052-384-7 PERL PUROGURAMINGU

Returns Next Character

$getc = HP15::getc(FILEHANDLE);
$getc = HP15::getc($filehandle);
$getc = HP15::getc;
This subroutine returns the next character from the input file attached to
FILEHANDLE. It returns undef at end-of-file, or if an I/O error was encountered.
If FILEHANDLE is omitted, the subroutine reads from STDIN.
This subroutine is somewhat slow, but it's occasionally useful for
single-character input from the keyboard -- provided you manage to get your
keyboard input unbuffered. This subroutine requests unbuffered input from the
standard I/O library. Unfortunately, the standard I/O library is not so standard
as to provide a portable way to tell the underlying operating system to supply
unbuffered keyboard input to the standard I/O system. To do that, you have to
be slightly more clever, and in an operating-system-dependent fashion. Under
Unix you might say this:
if ($BSD_STYLE) {
system "stty cbreak </dev/tty >/dev/tty 2>&1";
}
else {
system "stty", "-icanon", "eol", "\001";
}
$key = HP15::getc;
if ($BSD_STYLE) {
system "stty -cbreak </dev/tty >/dev/tty 2>&1";
}
else {
system "stty", "icanon", "eol", "^@"; # ASCII NUL
}
print "\n";
This code puts the next character typed on the terminal in the string $key. If
your stty program has options like cbreak, you'll need to use the code where
$BSD_STYLE is true. Otherwise, you'll need to use the code where it is false.
If you import getc "use HP15 qw(getc);", getc of your script will be rewritten
in HP15::getc. HP15::getc is not compatible with getc of JPerl.

Length by HP-15 Character

$length = HP15::length($string);
$length = HP15::length();
This subroutine returns the length in characters (programmer-visible characters)
of the scalar value $string. If $string is omitted, it returns the HP15::length
of $_.
Do not try to use HP15::length to find the size of an array or hash. Use scalar
@array for the size of an array, and scalar keys %hash for the number of key/value
pairs in a hash. (The scalar is typically omitted when redundant.)
To find the length of a string in bytes rather than characters, say simply:
$bytes = length($string);
Even if you do not know this subroutine, there is no problem. This subroutine
can be created with
$len = split(//, $jstring);
as before.
See:
P.558 JPerl (Japanese Perl)
Appendix C Supplement the Japanese version
ISBN 4-89052-384-7 PERL PUROGURAMINGU

Substr by HP-15 Character

$substr = HP15::substr($string,$offset,$length,$replacement);
$substr = HP15::substr($string,$offset,$length);
$substr = HP15::substr($string,$offset);
This subroutine extracts a substring out of the string given by $string and returns
it. The substring is extracted starting at $offset characters from the front of
the string. First character is at offset zero. If $offset is negative, starts that
far back from the end of the string.
If $length is omitted, returns everything through the end of the string. If $length
is negative, leaves that many characters off the end of the string. Otherwise,
$length indicates the length of the substring to extract, which is sort of what
you'd expect.
my $s = "The black cat climbed the green tree";
my $color = HP15::substr $s, 4, 5; # black
my $middle = HP15::substr $s, 4, -11; # black cat climbed the
my $end = HP15::substr $s, 14; # climbed the green tree
my $tail = HP15::substr $s, -4; # tree
my $z = HP15::substr $s, -4, 2; # tr
If Perl version 5.14 or later, you can use the HP15::substr() subroutine as an
lvalue. In its case $string must itself be an lvalue. If you assign something
shorter than $length, the string will shrink, and if you assign something longer
than $length, the string will grow to accommodate it. To keep the string the
same length, you may need to pad or chop your value using sprintf.
If $offset and $length specify a substring that is partly outside the string,
only the part within the string is returned. If the substring is beyond either
end of the string, HP15::substr() returns the undefined value and produces a
warning. When used as an lvalue, specifying a substring that is entirely outside
the string raises an exception. Here's an example showing the behavior for
boundary cases:
my $name = 'fred';
HP15::substr($name, 4) = 'dy'; # $name is now 'freddy'
my $null = HP15::substr $name, 6, 2; # returns "" (no warning)
my $oops = HP15::substr $name, 7; # returns undef, with warning
HP15::substr($name, 7) = 'gap'; # raises an exception
An alternative to using HP15::substr() as an lvalue is to specify the replacement
string as the 4th argument. This allows you to replace parts of the $string and
return what was there before in one operation, just as you can with splice().
my $s = "The black cat climbed the green tree";
my $z = HP15::substr $s, 14, 7, "jumped from"; # climbed
# $s is now "The black cat jumped from the green tree"
Note that the lvalue returned by the three-argument version of HP15::substr() acts
as a 'magic bullet'; each time it is assigned to, it remembers which part of the
original string is being modified; for example:
$x = '1234';
for (HP15::substr($x,1,2)) {
$_ = 'a'; print $x,"\n"; # prints 1a4
$_ = 'xyz'; print $x,"\n"; # prints 1xyz4
$x = '56789';
$_ = 'pq'; print $x,"\n"; # prints 5pq9
}
With negative offsets, it remembers its position from the end of the string when
the target string is modified:
$x = '1234';
for (HP15::substr($x, -3, 2)) {
$_ = 'a'; print $x,"\n"; # prints 1a4, as above
$x = 'abcdefg';
print $_,"\n"; # prints f
}
Prior to Perl version 5.10, the result of using an lvalue multiple times was
unspecified. Prior to 5.16, the result with negative offsets was unspecified.

Index by HP-15 Character

$index = HP15::index($string,$substring,$offset);
$index = HP15::index($string,$substring);
This subroutine searches for one string within another. It returns the character
position of the first occurrence of $substring in $string. The $offset, if
specified, says how many characters from the start to skip before beginning to
look. Positions are based at 0. If the substring is not found, the subroutine
returns one less than the base, ordinarily -1. To work your way through a string,
you might say:
$pos = -1;
while (($pos = HP15::index($string, $lookfor, $pos)) > -1) {
print "Found at $pos\n";
$pos++;
}

Rindex by HP-15 Character

$rindex = HP15::rindex($string,$substring,$offset);
$rindex = HP15::rindex($string,$substring);
This subroutine works just like HP15::index except that it returns the character
position of the last occurrence of $substring in $string (a reverse HP15::index).
The subroutine returns -1 if $substring is not found. $offset, if specified, is
the rightmost character position that may be returned. To work your way through
a string backward, say:
$pos = HP15::length($string);
while (($pos = HP15::rindex($string, $lookfor, $pos)) >= 0) {
print "Found at $pos\n";
$pos--;
}

Eval HP-15 Script

$eval = HP15::eval { block };
$eval = HP15::eval $expr;
$eval = HP15::eval;
The HP15::eval keyword serves two distinct but related purposes in JPerl.
These purposes are represented by two forms of syntax, HP15::eval { block }
and HP15::eval $expr. The first form traps runtime exceptions (errors)
that would otherwise prove fatal, similar to the "try block" construct in
C++ or Java. The second form compiles and executes little bits of code on
the fly at runtime, and also (conveniently) traps any exceptions just like
the first form. But the second form runs much slower than the first form,
since it must parse the string every time. On the other hand, it is also
more general. Whichever form you use, HP15::eval is the preferred way to do
all exception handling in JPerl.
For either form of HP15::eval, the value returned from an HP15::eval is
the value of the last expression evaluated, just as with subroutines.
Similarly, you may use the return operator to return a value from the
middle of the eval. The expression providing the return value is evaluated
in void, scalar, or list context, depending on the context of the
HP15::eval itself. See wantarray for more on how the evaluation context
can be determined.
If there is a trappable error (including any produced by the die operator),
HP15::eval returns undef and puts the error message (or object) in $@. If
there is no error, $@ is guaranteed to be set to the null string, so you
can test it reliably afterward for errors. A simple Boolean test suffices:
HP15::eval { ... }; # trap runtime errors
if ($@) { ... } # handle error
(Prior to Perl 5.16, a bug caused undef to be returned in list context for
syntax errors, but not for runtime errors.)
The HP15::eval { block } form is syntax checked and compiled at compile time,
so it is just as efficient at runtime as any other block. (People familiar
with the slow HP15::eval $expr form are occasionally confused on this issue.)
Because the { block } is compiled when the surrounding code is, this form of
HP15::eval cannot trap syntax errors.
The HP15::eval $expr form can trap syntax errors because it parses the code
at runtime. (If the parse is unsuccessful, it places the parse error in $@,
as usual.) If $expr is omitted, evaluates $_ .
Otherwise, it executes the value of $expr as though it were a little JPerl
script. The code is executed in the context of the current of the current
JPerl script, which means that it can see any enclosing lexicals from a
surrounding scope, and that any nonlocal variable settings remain in effect
after the HP15::eval is complete, as do any subroutine or format definitions.
The code of the HP15::eval is treated as a block, so any locally scoped
variables declared within the HP15::eval last only until the HP15::eval is
done. (See my and local.) As with any code in a block, a final semicolon is
not required.
HP15::eval will be escaped as follows:
-------------------------------------------------
Before After
-------------------------------------------------
HP15::eval { block } eval { block }
HP15::eval $expr eval HP15::escape $expr
HP15::eval eval HP15::escape
-------------------------------------------------
To tell the truth, the subroutine HP15::eval does not exist. If it exists,
you will troubled, when HP15::eval has a parameter that is single quoted
string included my variables. HP15::escape is a subroutine that makes Perl
script from JPerl script.
Here is a simple JPerl shell. It prompts the user to enter a string of
arbitrary JPerl code, compiles and executes that string, and prints whatever
error occurred:
#!/usr/bin/perl
# jperlshell.pl - simple JPerl shell
use HP15;
print "\nEnter some JPerl code: ";
while (<STDIN>) {
HP15::eval;
print $@;
print "\nEnter some more JPerl code: ";
}
Here is a rename.pl script to do a mass renaming of files using a JPerl
expression:
#!/usr/bin/perl
# rename.pl - change filenames
use HP15;
$op = shift;
for (@ARGV) {
$was = $_;
HP15::eval $op;
die if $@;
# next line calls the built-in function, not
# the script by the same name
if ($was ne $_) {
print STDERR "rename $was --> $_\n";
rename($was,$_);
}
}
You'd use that script like this:
C:\WINDOWS> perl rename.pl 's/\.orig$//' *.orig
C:\WINDOWS> perl rename.pl 'y/A-Z/a-z/ unless /^Make/' *
C:\WINDOWS> perl rename.pl '$_ .= ".bad"' *.f
Since HP15::eval traps errors that would otherwise prove fatal, it is useful
for determining whether particular features (such as fork or symlink) are
implemented.
Because HP15::eval { block } is syntax checked at compile time, any syntax
error is reported earlier. Therefore, if your code is invariant and both
HP15::eval $expr and HP15::eval { block } will suit your purposes equally
well, the { block } form is preferred. For example:
# make divide-by-zero nonfatal
HP15::eval { $answer = $a / $b; };
warn $@ if $@;
# same thing, but less efficient if run multiple times
HP15::eval '$answer = $a / $b';
warn $@ if $@;
# a compile-time syntax error (not trapped)
HP15::eval { $answer = }; # WRONG
# a runtime syntax error
HP15::eval '$answer ='; # sets $@
Here, the code in the { block } has to be valid JPerl code to make it past
the compile phase. The code in the $expr doesn't get examined until runtime,
so it doesn't cause an error until runtime.
Using the HP15::eval { block } form as an exception trap in libraries does
have some issues. Due to the current arguably broken state of __DIE__ hooks,
you may wish not to trigger any __DIE__ hooks that user code may have
installed. You can use the local $SIG{__DIE__} construct for this purpose,
as this example shows:
# a private exception trap for divide-by-zero
HP15::eval { local $SIG{'__DIE__'}; $answer = $a / $b; };
warn $@ if $@;
This is especially significant, given that __DIE__ hooks can call die again,
which has the effect of changing their error messages:
# __DIE__ hooks may modify error messages
{
local $SIG{'__DIE__'} =
sub { (my $x = $_[0]) =~ s/foo/bar/g; die $x };
HP15::eval { die "foo lives here" };
print $@ if $@; # prints "bar lives here"
}
Because this promotes action at a distance, this counterintuitive behavior
may be fixed in a future release.
With an HP15::eval, you should be especially careful to remember what's being
looked at when:
HP15::eval $x; # CASE 1
HP15::eval "$x"; # CASE 2
HP15::eval '$x'; # CASE 3
HP15::eval { $x }; # CASE 4
HP15::eval "\$$x++"; # CASE 5
$$x++; # CASE 6
CASEs 1 and 2 above behave identically: they run the code contained in the
variable $x. (Although CASE 2 has misleading double quotes making the reader
wonder what else might be happening (nothing is).) CASEs 3 and 4 likewise
behave in the same way: they run the code '$x' , which does nothing but return
the value of $x. (CASE 4 is preferred for purely visual reasons, but it also
has the advantage of compiling at compile-time instead of at run-time.) CASE 5
is a place where normally you would like to use double quotes, except that in
this particular situation, you can just use symbolic references instead, as
in CASE 6.
Before Perl 5.14, the assignment to $@ occurred before restoration of
localized variables, which means that for your code to run on older versions,
a temporary is required if you want to mask some but not all errors:
# alter $@ on nefarious repugnancy only
{
my $e;
{
local $@; # protect existing $@
HP15::eval { test_repugnancy() };
# $@ =~ /nefarious/ and die $@; # Perl 5.14 and higher only
$@ =~ /nefarious/ and $e = $@;
}
die $e if defined $e
}
The block of HP15::eval { block } does not count as a loop, so the loop
control statements next, last, or redo cannot be used to leave or restart the
block.

$byte = CORE::chop($string);
$byte = CORE::chop(@list);
$byte = CORE::chop;
This function chops off the last byte of a string variable and returns the
byte chopped. The CORE::chop operator is used primarily to remove the newline
from the end of an input record, and is more efficient than using a
substitution (s/\n$//). If that's all you're doing, then it would be safer to
use chomp, since CORE::chop always shortens the string no matter what's there,
and chomp is more selective.
You cannot CORE::chop a literal, only a variable.
If you CORE::chop a @list of variables, each string in the list is chopped:
@lines = `cat myfile`;
CORE::chop @lines;
You can CORE::chop anything that is an lvalue, including an assignment:
CORE::chop($cwd = `pwd`);
CORE::chop($answer = <STDIN>);
This is different from:
$answer = CORE::chop($temp = <STDIN>); # WRONG
which puts a newline into $answer because CORE::chop returns the byte chopped,
not the remaining string (which is in $tmp). One way to get the result
intended here is with substr:
$answer = substr <STDIN>, 0, -1;
But this is more commonly written as:
CORE::chop($answer = <STDIN>);
In the most general case, CORE::chop can be expressed in terms of substr:
$last_byte = CORE::chop($var);
$last_byte = substr($var, -1, 1, ""); # same thing
Once you understand this equivalence, you can use it to do bigger chops. To
CORE::chop more than one byte, use substr as an lvalue, assigning a null
string. The following removes the last five bytes of $caravan:
substr($caravan, -5) = "";
The negative subscript causes substr to count from the end of the string
instead of the beginning. If you wanted to save the bytes so removed, you
could use the four-argument form of substr, creating something of a quintuple
CORE::chop:
$tail = substr($caravan, -5, 5, "");
If no argument is given, the function chops the $_ variable.

Ordinal Value of Byte

$ord = CORE::ord($expr);
This function returns the numeric value of the first byte of $expr, regardless
of "use HP15 qw(ord);" exists or not. If $expr is omitted, it uses $_.
The return value is always unsigned.
If you want a signed value, use unpack('c',$expr). If you want all the bytes of
the string converted to a list of numbers, use unpack('C*',$expr) instead.

Reverse List or Byte String

@reverse = CORE::reverse(@list);
$reverse = CORE::reverse(@list);
In list context, this function returns a list value consisting of the elements
of @list in the opposite order.
In scalar context, the function concatenates all the elements of @list and then
returns the reverse of that resulting string, byte by byte, regardless of
"use HP15 qw(reverse);" exists or not.

Returns Next Byte

$getc = CORE::getc(FILEHANDLE);
$getc = CORE::getc($filehandle);
$getc = CORE::getc;
This function returns the next byte from the input file attached to FILEHANDLE.
It returns undef at end-of-file, or if an I/O error was encountered. If
FILEHANDLE is omitted, the function reads from STDIN.
This function is somewhat slow, but it's occasionally useful for single-byte
input from the keyboard -- provided you manage to get your keyboard input
unbuffered. This function requests unbuffered input from the standard I/O library.
Unfortunately, the standard I/O library is not so standard as to provide a portable
way to tell the underlying operating system to supply unbuffered keyboard input to
the standard I/O system. To do that, you have to be slightly more clever, and in
an operating-system-dependent fashion. Under Unix you might say this:
if ($BSD_STYLE) {
system "stty cbreak </dev/tty >/dev/tty 2>&1";
}
else {
system "stty", "-icanon", "eol", "\001";
}
$key = CORE::getc;
if ($BSD_STYLE) {
system "stty -cbreak </dev/tty >/dev/tty 2>&1";
}
else {
system "stty", "icanon", "eol", "^@"; # ASCII NUL
}
print "\n";
This code puts the next single-byte typed on the terminal in the string $key.
If your stty program has options like cbreak, you'll need to use the code where
$BSD_STYLE is true. Otherwise, you'll need to use the code where it is false.

Index by Byte String

$index = CORE::index($string,$substring,$offset);
$index = CORE::index($string,$substring);
This function searches for one byte string within another. It returns the position
of the first occurrence of $substring in $string. The $offset, if specified, says
how many bytes from the start to skip before beginning to look. Positions are based
at 0. If the substring is not found, the function returns one less than the base,
ordinarily -1. To work your way through a string, you might say:
$pos = -1;
while (($pos = CORE::index($string, $lookfor, $pos)) > -1) {
print "Found at $pos\n";
$pos++;
}

Rindex by Byte String

$rindex = CORE::rindex($string,$substring,$offset);
$rindex = CORE::rindex($string,$substring);
This function works just like CORE::index except that it returns the position of
the last occurrence of $substring in $string (a reverse CORE::index). The function
returns -1 if not $substring is found. $offset, if specified, is the rightmost
position that may be returned. To work your way through a string backward, say:
$pos = CORE::length($string);
while (($pos = CORE::rindex($string, $lookfor, $pos)) >= 0) {
print "Found at $pos\n";
$pos--;
}

The yada yada operator (noted ...) is a placeholder for code. Perl parses it
without error, but when you try to execute a yada yada, it throws an exception
with the text Unimplemented:
sub unimplemented { ... }
eval { unimplemented() };
if ( $@ eq 'Unimplemented' ) {
print "I found the yada yada!\n";
}
You can only use the yada yada to stand in for a complete statement. These
examples of the yada yada work:
{ ... }
sub foo { ... }
...;
eval { ... };
sub foo {
my( $self ) = shift;
...;
}
do { my $n; ...; print 'Hurrah!' };
The yada yada cannot stand in for an expression that is part of a larger statement
since the ... is also the three-dot version of the range operator
(see "Range Operators"). These examples of the yada yada are still syntax errors:
print ...;
open my($fh), '>', '/dev/passwd' or ...;
if ( $condition && ... ) { print "Hello\n" };
There are some cases where Perl can't immediately tell the difference between an
expression and a statement. For instance, the syntax for a block and an anonymous
hash reference constructor look the same unless there's something in the braces that
give Perl a hint. The yada yada is a syntax error if Perl doesn't guess that the
{ ... } is a block. In that case, it doesn't think the ... is the yada yada because
it's expecting an expression instead of a statement:
my @transformed = map { ... } @input; # syntax error
You can use a ; inside your block to denote that the { ... } is a block and not a
hash reference constructor. Now the yada yada works:
my @transformed = map {; ... } @input; # ; disambiguates
my @transformed = map { ...; } @input; # ; disambiguates

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
CHAR_NONBLOCK.
Example:
SET CHAR_NONBLOCK=1
(The value '1' doesn't have the meaning)

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 HP15 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.

format

Function "format" can't handle multiple-octet code same as original Perl.

cloister of regular expression

The cloister (?s) and (?i) of a regular expression will not be implemented for the time being. Cloister (?s) can be substituted with the .(dot) and \N on /s modifier. Cloister (?i) can be substituted with \F...\E.

chdir

Function chdir() can always be executed with perl5.005.

There are the following limitations for DOS-like system(any of MSWin32, NetWare, symbian, dos).

On perl5.006 or perl5.00800, if path is ended by chr(0x5C), it needs jacode.pl library.

On perl5.008001 or later, perl5.010, perl5.012, perl5.014, perl5.016, perl5.018, perl5.020 if path is ended by chr(0x5C), chdir succeeds when a short path name (8dot3name) can be acquired according to COMMAND.COM or cmd.exe or Win95Cmd.exe. However, leaf-subdirectory of the current directory is a short path name (8dot3name).

If Perl version is older than 5.14, HP15::substr differs from CORE::substr, and cannot be used as a lvalue. To change part of a string, you need use the optional fourth argument which is the replacement string.

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.

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 '?'.

Look-behind Assertion

The look-behind assertion like (?<=[A-Z]) is not prevented from matching trail octet of the previous multiple-octet code.

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.

Named Character

A named character, such \N{GREEK SMALL LETTER EPSILON}, \N{greek:epsilon}, or \N{epsilon} is not supported.

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.

${^WIN32_SLOPPY_STAT} is ignored

Even if ${^WIN32_SLOPPY_STAT} is set to a true value, file test functions Ehp15::*(), Ehp15::lstat(), and Ehp15::stat() on Microsoft Windows open the file for the path which has chr(0x5c) at end.

Delimiter of String and Regexp

qq//, q//, qw//, qx//, qr//, m//, s///, tr///, and y/// can't use a wide character as the delimiter.

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.

There are people who don't agree to change in the character string processing model of Perl 5.8. It is impossible to get to agree it to majority of Perl user who hardly ever use Perl. How to solve it by returning to a original method, let's drag out page 402 of the old dusty Programming Perl, 3rd ed. again.

Old byte-oriented programs should not spontaneously break on the old byte-oriented data they used to work on.

This goal has been achieved by that this software is additional code for perl like utf8 pragma. Perl should work same as past Perl if added nothing.

Goal #2:

Old byte-oriented programs should magically start working on the new character-oriented data when appropriate.

Still now, 1 octet is counted with 1 by built-in functions length, substr, index, rindex, and pos that handle length and position of string. In this part, there is no change. The length of 1 character of 2 octet code is 2.

On the other hand, the regular expression in the script is added the multibyte anchoring processing with this software, instead of you.

There is a combination from (a) to (e) in data, script, and interpreter of old and new. Let's add the Encode module and this software did not exist at time of be written this document and JPerl did exist.

The reason why JPerl is very excellent is that it is at the position of (c). That is, it is not necessary to do a special description to the script to process new character-oriented string. (May the japerl take over JPerl!)

Goal #3:

Programs should run just as fast in the new character-oriented mode as in the old byte-oriented mode.

It is impossible. Because the following time is necessary.

(1) Time of escape script for old byte-oriented perl.

(2) Time of processing regular expression by escaped script while multibyte anchoring.

Someday, I want to ask Larry Wall about this goal in the elevator.

Goal #4:

Perl should remain one language, rather than forking into a byte-oriented Perl and a character-oriented Perl.

JPerl remains one Perl language by forking to two interpreters. However, the Perl core team did not desire fork of the interpreter. As a result, Perl language forked contrary to goal #4.

A character-oriented perl is not necessary to make it specially, because a byte-oriented perl can already treat the binary data. This software is only an application program of byte-oriented Perl, a filter program.

And you will get support from the Perl community, when you solve the problem by the Perl script.

HP15 software remains one language and one interpreter.

Goal #5:

JPerl users will be able to maintain JPerl by Perl.

May the JPerl be with you, always.

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 provides programming environment like at that time.

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
The most important thing for most people to know about handling
Unicode data in Perl, however, is that if you don't ever use any Uni-
code data -- if none of your files are marked as UTF-8 and you don't
use UTF-8 locales -- then you can happily pretend that you're back in
Perl 5.005_03 land; the Unicode features will in no way interfere with
your code unless you're explicitly using them. Sometimes the twin
goals of embracing Unicode but not disturbing old-style byte-oriented
scripts has led to compromise and confusion, but it's the Perl way to
silently do the right thing, which is what Perl ends up doing.
--- Advanced Perl Programming, 2nd Edition