2009-06-20

new distzilla plugin: prepender

when i first heard of dist::zilla, its concepts definitely appealed to me. it took me quite some time (never the good time, plus i needed to create the rpms for mandriva), but i finally managed to try it...

and although i still need to get used to it, i'm already really happy with it. on the new project that i recently started (more on that later on), i'm letting dist::zilla deal with all those pesky copyright, version, pod, etc. stuff.

however, i'm used to add some boilerplate at the top of my files, as the fsf recommends. and i found nothing in dist::zilla to do that... so i just wrote a new plugin for it: dist::zilla::plugin::prepender.

just add the following in your dist.ini file:
[Prepender]
line = #
line = # This file is part of Foo::Bar
line = #
line = # Foo::Bar is copyright...
but it can also be used to enforce some common pragma: since it will be inserted at the top of the file, the pragma will be applied to its lexical scope - the whole file itself in this case:
[Prepender]
line = use strict;
line = use warnings;
since those usages are quite common, i might as well in a future version propose them as options:
[Prepender]
copyright = 1
strict = 1
warnings = 1
but i'm not really sure... wdyt?

2 comments:

  1. Copyright would be useful. Adding strict and warnings at dist build time makes no sense. You're going to want those present for your tests.

    ReplyDelete
  2. @autarch: well, they would also be present for tests, since they are also handled by dist-zilla using "dzil test"

    ReplyDelete