B-C
view release on metacpan or search on metacpan
the same as on the host. It's is strongly recommended to also have
the same byteorder, ivsize and nvsize settings on the native host.
DIFFERENCES
The result of running a CC compiled Perl program can sometimes be different
from running the same program with standard perl. Think of the compiler
as having a slightly different implementation of the language Perl.
Unfortunately, since Perl has had a single implementation until now,
there are no formal standards or documents defining what behaviour is
guaranteed of Perl the language and what just "happens to work".
Some of the differences below are almost impossible to change because of
the way the compiler works. Others can be changed to produce "standard"
perl behaviour if it's deemed proper and the resulting performance hit
is accepted. I'll use "standard perl" to mean the result of running a
Perl program using the perl executable from the perl distribution.
I'll use "compiled Perl program" to mean running an executable produced
by this compiler kit ("the compiler") with the CC backend.
Loops
Standard perl calculates the target of "next", "last", and "redo"
at run-time. The compiler calculates the targets at compile-time.
For example, the program
sub skip_on_odd { next NUMBER if $_[0] % 2 }
NUMBER: for ($i = 0; $i < 5; $i++) {
skip_on_odd($i);
print $i;
}
produces the output
024
with standard perl but gives a compile-time error with the compiler.
See test 21.
Context of ".."
The context (scalar or array) of the ".." operator determines whether
it behaves as a range or a flip/flop. Standard perl delays until
runtime the decision of which context it is in but the compiler needs
to know the context at compile-time. For example,
@a = (4,6,1,0,0,1);
sub range { (shift @a)..(shift @a) }
print range();
while (@a) { print scalar(range()) }
generates the output
456123E0
with standard Perl but gives a compile-time error with compiled Perl.
See test 30.
Arithmetic
Optimized compiled Perl programs use native C arithmetic
much more frequently than standard perl. So operations on
large numbers or on boundary cases may produce different behaviour.
Deprecated features
Features of standard perl such as $[ which have been deprecated
in standard perl since version 5 was released have not been
implemented in the compiler.
STATUS
C is stable, CC is unstable.
Bytecode stable until 5.16
The Bytecode compiler is disabled for 5.6.2, use the default instead.
See STATUS for details.
BUGS
Here are some things which may cause the compiler problems.
The following render the compiler useless (without serious hacking):
* The following operators are not yet implemented for CC
goto
continue/next/last to a outer LABEL
* You can't use "last" to exit from a non-loop block.
* use Attribute::Handlers, or run-time usage of attributes. Usage of
Attribute::Handlers is discouraged generally for security reasons, as it
evals all attributes. (#169)
* Accessing @- values from compiled regular expressions are currently broken (#281)
The following may give significant problems:
* BEGIN blocks containing complex initialisation code,
esp. sideeffects. All the BEGIN code is evaluated once at compile-time,
and NOT executed at run-time.
* Code which is only ever referred to at runtime (e.g. via eval "..." or
via method calls): see the -u option for the C and CC backends.
* compile-time perlio layers. Use them at run-time instead.
i.e. use open qw(:std :utf8) does not work yet on STDIN.
* run-time loading of DynaLoader packages which use AutoLoad (i.e. BSD::Resource).
Compile them in, e.g. with use package. (#308)
* format STDOUT or STDERR (#285)
The following may cause problems (not thoroughly tested):
* For the C and CC backends: compile-time strings which are longer than
your C compiler can cope with in a single line or definition.
Use perlcc to workaround MSVC problems.
* Reliance on intimate details of global destruction. Implemented only with 1.46
There is a terser but more complete list in the Todo file.
LICENSE
This program is free software; you can redistribute it and/or modify
it under the terms of either:
a) the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any
later version, or
b) the "Artistic License" which comes with this kit.
( run in 1.201 second using v1.01-cache-2.11-cpan-804bf51f3ce )