View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
perlancar > Data-Sah > Data::Sah::Compiler



Annotate this POD



New  1
Open  1
View/Report Bugs
Module Version: 0.892   Source  


Data::Sah::Compiler - Base class for Sah compilers (Data::Sah::Compiler::*)


This document describes version 0.892 of Data::Sah::Compiler (from Perl distribution Data-Sah), released on 2018-06-05.



main => OBJ

Reference to the main Data::Sah object.

expr_compiler => OBJ

Reference to expression compiler object. In the perl compiler, for example, this will be an instance of Language::Expr::Compiler::Perl object.


new() => OBJ

$c->compile(%args) => HASH

Compile schema into target language.

Arguments (* denotes required arguments, subclass may introduce others):

Compilation data

During compilation, compile() will call various hooks (listed below). The hooks will be passed compilation data ($cd) which is a hashref containing various compilation state and result. Compilation data is written to this hashref instead of on the object's attributes to make it easy to do recursive compilation (compilation of subschemas).

Keys that are put into this compilation data include input data, compilation state, and others. Many of these keys might exist only temporarily during certain phases of compilation and will no longer exist at the end of compilation, for example clause will only exist during processing of a clause and will be seen by hooks like before_clause and after_clause, it will not be seen by before_all_clauses or after_compile.

For a list of keys, see "COMPILATION DATA KEYS". Subclasses may add more data; see their respective documentation.

Return value

The compilation data will be returned as return value. Main result will be in the result key. There is also ccls, and subclasses may put additional results in other keys. Final usable result might need to be pieced together from these results, depending on your needs.


By default this base compiler does not define any hooks; subclasses can define hooks to implement their compilation process. Each hook will be passed compilation data, and should modify or set the compilation data as needed. The hooks that compile() will call at various points, in calling order, are:




Please visit the project's homepage at


Source repository is at


Please report any bugs or feature requests on the bugtracker website

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


This software is copyright (c) 2018, 2017, 2016, 2015, 2014, 2013, 2012 by

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

syntax highlighting: