NAME

Dist::Zilla::Plugin::TemplateXS - A simple xs-file-from-template plugin

VERSION

version 0.005

SYNOPSIS

; In your profile.ini
[TemplateXS]
style = MakeMaker
include = ppport.h

DESCRIPTION

This is a FileGatherer used for creating new XS files when minting a new dist with dzil new. It uses Text::Template (via Dist::Zilla::Role::TextTemplate) to render a template into a XS file. The template is given three variables for use in rendering: $name, the module name; $dist, the Dist::Zilla object, and $style, the style attribute that determines the location of the new file.

ATTRIBUTES

style

This mandatory argument affects the location of the new XS file. Possible values are:

  • MakeMaker

    This will cause the XS file for Foo::Bar to be written to Bar.xs.

  • ModuleBuild

    This will cause the XS file for Foo::Bar to be written to lib/Foo/Bar.xs.

prototypes_line

If enabled, a prototypes lines will be emitted. This is necessary when using ExtUtils::MakeMaker, but when using Module::Build or Module::Build::Tiny, so it's enabled by default only when style is MakeMaker.

template

This contains the path to the template that is to be used. If not set, a default template will be used that looks something like this:

#define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

{{ $includes }}

MODULE = {{ $module }}				PACKAGE = {{ $module }}

{{ $prototypes_line ? 'PROTOTYPES: DISABLE\n' : '' }}

AUTHOR

Leon Timmermans <leont@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Leon Timmermans.

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