Comment out code in your scripts and modules
[CommentOut]
id = dev-only
This plugin comments out lines of code in your Perl scripts or modules with the provided identification. This allows you to have code in your development tree that gets commented out before it gets shipped by Dist::Zilla as a tarball.
I use perlbrew and/or perls installed in funny places and I'd like to be able to run
executables out of by git checkout tree without invoking perl -Ilib
on
every call. To that end I write something like this:
#!/usr/bin/env perl
use strict;
use warnings;
use lib::findbin '../lib'; # dev-only
use App::MyApp;
That is lovely, except that the main toolchain installers EUMM and MB will
convert /usr/bin/perl
but not /usr/bin/env perl
to the correct perl
when the distribution is installed. There
is a handy plugin [SetScriptShebang]
that solves that problem but the
use lib::findbin '../lib';
is problematic because ../lib
relative to
the install location might not be right! With both [SetScriptShebang]
and this plugin, I can fix both problems:
[SetScriptShebang]
[CommentOut]
And my script will be converted to:
#!perl
use strict;
use warnings;
#use lib::findbin '../lib'; # dev-only
use App::MyApp;
Which is the right thing for CPAN. Since lines are commented out, line numbers are retained.
The comment id to search for. The default is dev-only
.
Remove lines instead of comment them out.
For block comments, the id to use for the beginning of the block.
Block comments are off unless both begin
and end
are specified.
For block comments, the id to use for the beginning of the block.
Block comments are off unless both begin
and end
are specified.
-
Does something very similar. I did actually do a survay of Dist::Zilla plugins before writing this one, but apparently I missed this one. Anyway I prefer
[CommentOut]
as it is configurable.
Author: Graham Ollis [email protected]
Contributors:
Mohammad S Anwar (MANWAR)
This software is copyright (c) 2017-2024 by Graham Ollis.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.