GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Language::Expr::Compiler::perl(3) User Contributed Perl Documentation Language::Expr::Compiler::perl(3)

Language::Expr::Compiler::perl - Compile Language::Expr expression to Perl

This document describes version 0.29 of Language::Expr::Compiler::perl (from Perl distribution Language-Expr), released on 2016-07-03.

 use Language::Expr::Compiler::Perl;
 my $plc = Language::Expr::Compiler::Perl->new;
 print $plc->perl('1 ^^ 2'); # prints '1 xor 2'

Compiles Language::Expr expression to Perl code. Some notes:

  • Emitted Perl code version

    Emitted Perl code requires Perl 5.10 (it uses 5.10's "//" defined-or operator) and also the boolean module (it uses 'true' and 'false' objects).

  • Perliness

    The emitted Perl code will follow Perl's notion of true and false, e.g. the expression '"" || "0" || 2' will result to 2 since Perl thinks that "" and "0" are false. It is also weakly typed like Perl, i.e. allows '1 + "2"' to become 3.

  • Variables by default simply use Perl variables.

    E.g. $a becomes $a, and so on. Be careful not to make variables which are invalid in Perl, e.g. $.. or ${foo/bar} (but ${foo::bar} is okay because it translates to $foo::bar).

    You can customize this behaviour by subclassing rule_var() or by providing a hook_var() (see documentation in Language::Expr::Compiler::Base).

  • Functions by default simply use Perl functions.

    Unless those specified in func_mapping. For example, if $compiler->func_mapping->{foo} = "Foo::do_it", then the expression 'foo(1)' will be compiled into 'Foo::do_it(1)'.

    You can customize this behaviour by subclassing rule_func() or by providing a hook_func() (see documentation in Language::Expr::Compiler::Base).

Convert Language::Expr expression into Perl code. Dies if there is syntax error in expression.

Convert Language::Expr expression into Perl code and then eval() it.

Please visit the project's homepage at <https://metacpan.org/release/Language-Expr>.

Source repository is at <https://github.com/sharyanto/perl-Language-Expr>.

Please report any bugs or feature requests on the bugtracker website <https://rt.cpan.org/Public/Dist/Display.html?Name=Language-Expr>

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

perlancar <perlancar@cpan.org>

This software is copyright (c) 2016 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

2016-07-03 perl v5.40.2

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.