NAME

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

VERSION

version 0.003

SYNOPSIS

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

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.

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"
 
 MODULE = {{ $name }}                           PACKAGE = {{ $name }}
 
 PROTOTYPES: DISABLED

METHODS

filename($module_name)

This returns the filename for $module_name, given the specified style.

content($module_name)

This returns the appropriate content for $module_name.

gather_files()

This adds an XS file for the main module of the distribution.

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.