View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
David Mertens > C-TinyCompiler > C::TinyCompiler::Perl::Croak



Annotate this POD

View/Report Bugs
Module Version: 0.05   Source  


C::TinyCompiler::Perl::Croak - A light-weight interface to Perl's croak and warn


 use C::TinyCompiler;
 # Declare the compiler context with the AV bindings:
 my $context= C::TinyCompiler->new(packages => '::Perl::Croak');
 # Create a rather antisocial function:
 $context->code('Body') = q{
     void dont_call(void) {
         croak("I told you not to call!");
 # Compile and call:
 eval {
 } or do {
     print "Got error $@\n";


This module provides Perl's C interface to both the traditional and variadic forms of warn and croak. These allow you to write defensive C code without needing the full Perl C api to do it.

Like other C::TinyCompiler packages, you never use this module directly. Rather, you add it to your compiler context in the constructor or with the function "apply_packages" in C::TinyCompiler.

You can find documentation for these functions at perlapi. However, the discussion of the variadic forms of is not terribly illuminating, so I provide a few examples below.


David Mertens, <dcmertens.perl at>


Please report any bugs or feature requests at the project's main github page:


You can find documentation for this module with the perldoc command.

    perldoc C::TinyCompiler::Perl::Croak

You can also look for information at:


Code copyright 2011-2012 Northwestern University. Documentation copyright 2011-2013 David Mertens.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See for more information.

syntax highlighting: