David Mertens > C-TinyCompiler > C::TinyCompiler::Perl::Croak

Download:
C-TinyCompiler-0.04.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.04   Source  

NAME ^

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

SYNOPSIS ^

 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:
 $context->compile;
 eval {
     $context->call_function('dont_call');
     1
 } or do {
     print "Got error $@\n";
 };

DESCRIPTION ^

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.

AUTHOR ^

David Mertens, <dcmertens.perl at gmail.com>

BUGS ^

Please report any bugs or feature requests at the project's main github page: http://github.com/run4flat/perl-TCC/issues.

SUPPORT ^

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

    perldoc C::TinyCompiler::Perl::Croak

You can also look for information at:

LICENSE AND COPYRIGHT ^

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 http://dev.perl.org/licenses/ for more information.

syntax highlighting: