Dist::Zilla Re-Generates

Still stuck in weaver land here in the Dist-pen

Today I am going to look at [GenerateSection] section plug-in. This one look very interesing to me as it lets on generate a section from with-in the 'weaver.ini' file.

Now in my case I would love to have a common header and footer for my Tutorial pod without having to add the same section over and over again in each POD doc. I am hoping that this plug-in will get most if not all of what I need.

Right now I am just going to go for a simple all text version for now as I am not 100% sure how to get extra variable content into Dist::Zilla and Pod::Weaver.

So I would like to get something like this

=head3 Database::Accessor Tutorial

Welcome to Page xxxxx

where xxxx is the current page name,

To set this up I will need to add the following into my 'weaver.ini' file

title={{$dist->{name}}} Tutorial
text= Welcome to Page {{$name}}

In the above I am using three attributes; 'head' which will set the heading level of the section. 'title' which will set the value next to that heading, you can also pass this value along with the plug-in name. 'text' is used to pass in the text of your section, you can have as many 'text' sections as you want but they are all contraindicated together so you will have to make sure to put some blank space in where needed. The '{{}}' are used to tell the plug-in to interpolate the value and plug it in.
After a quick install of the plug-in and a clean and build with dzil this is what I get;

=head3 {{$dist->{name}}}} Tutorial
Welcome to Page Database-Accessor

So a few things here.

I can't use any variables in the title section and $name is not picking up the name of the file but the name of the distribution. So useful to a point but I think I will have to be doing a good deal of research before I can get this to work the way I want, or maybe I can modify it and create my own plug-in some day.

There are two number of other attributes besides the three I show above. 'is_tempate' when set to '0' (false) it will not interpolate any variable in {{}} it will just print out '{{$name}}' for example.
As wel there is 'main_module_only' that when set to true (any value other than 0) will only generate the section on the main page.

Well I something to work with.


Leave a comment

About byterock

user-pic Long time Perl guy, a few CPAN mods allot of work on DBD::Oracle and a few YAPC presentations