The Perl Advent Calendar needs more articles for 2022. Submit your idea today!


Stenciller::Transformer - A role for transformer plugins to consume


Version 0.1400, released 2016-02-03.


    package Stenciller::Plugin::MyNewRenderer;

    use Moose;
    with 'Stenciller::Transformer';

    sub transformer {


This is the role that all Stenciller plugins must consume. It requires a transformer method to be implemented.



This method must be implemented by classes consuming this role.

It takes one attribute:


$transform_args is a hash reference with the following structure:

    $transform_args => {
        skip_header_lines => 0|1,
        stencils => [...],
        require_in_extra => {
            key => '...',
            value => '...',
            default => '...',

skip_header_lines => 1

skip_header_lines takes a boolean indicating if the Stenciller's header_lines should be skipped. Default is 0.

stencils => [ ]

stencils takes an array reference of which stencils in the currently parsed file that should be included in the output. The index is zero based. If stencils is not given, all stencils are parsed.

require_in_extra => { }

require_in_extra allows finer filtering than stencils. Usually, the point to using Stenciller, and related modules, is to use the same content more than once (eg. include it in pod, create html files with examples, and create tests). It is not always necessary to include every stencil in every end product.

If require_in_extra is given, it looks in the options hash for every stencil for the key key.

  • If key exists in the stencil's hash, and it has the value value, then the stencil is parsed.

  • If key exists in the stencil's hash, and it doesn't have the value value, then the stencil is not parsed.

  • If key doesn't exist in the stencil's hash, then the two first rules are applied as if the stencil had the default value.



The Stenciller object is passed automatically to plugins.




Erik Carlsson <>


This software is copyright (c) 2016 by Erik Carlsson.

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