Perl::Critic::Policy::logicLAB::RequireSheBang - simple policy for keeping your shebang line uniform
This policy is a policy in the Perl::Critic::logicLAB distribution. The policy is themed: logiclab.
This documentation describes version 0.07.
This policy is intended in guarding your use of the shebang line. It assists in making sure that your shebang line adheres to certain formats.
The default format is
#!/usr/local/bin/perl
You can however specify another or define your own in the configuration of the policy.
NB this policy does currently not warn about missing shebang lines, it only checks shebang lines encountered.
This policy allow you to configure the contents of the shebang lines you want to allow using "formats".
[logicLAB::RequireSheBang]
formats = #!/usr/local/bin/perl || #!/usr/bin/perl || #!perl || #!env perl
Since the default shebang line enforced by the policy is:
#!/usr/local/bin/perl
Please note that if you however what to extend the pattern, you also have to specify was is normally the default pattern since configuration overwrites the default even for extensions.
This mean that if you want to allow:
#!/usr/local/bin/perl
#!/usr/local/bin/perl -w
#!/usr/local/bin/perl -wT
Your format should look like the following:
[logicLAB::RequireSheBang]
formats = #!/usr/local/bin/perl || #!/usr/local/bin/perl -w || #!/usr/local/bin/perl -wT
You can specify if you want to check modules also. The default is to exempt from checking shebang lines in modules.
[logicLAB::RequireSheBang]
exempt_modules = 0
Optionally and for development purposes I have added a debug flag. This can be set in your Perl::Critic configuration file as follows:
[logicLAB::RequireSheBang]
debug = 1
This enables more explicit output on what is going on during the actual processing of the policy.
This distribution has no known incompatibilities.
The distribution has now known bugs or limitations. It locates shebang lines through out the source code, not limiting itself to the first line. This might however change in the future, but will propably be made configurable if possible.
Please use Request Tracker for bug reporting:
The following policies have been disabled for this distribution
Perl::Critic::Policy::ValuesAndExpressions::ProhibitConstantPragma
Constants are good, - see the link below.
See also t/perlcriticrc
Coverage test executed the following way, the coverage report is based on the version described in this documentation (see "VERSION").
./Build testcover
---------------------------- ------ ------ ------ ------ ------ ------ ------
File stmt bran cond sub pod time total
---------------------------- ------ ------ ------ ------ ------ ------ ------
...ogicLAB/RequireSheBang.pm 70.4 64.3 44.4 100.0 100.0 100.0 72.1
Total 70.4 64.3 44.4 100.0 100.0 100.0 72.1
---------------------------- ------ ------ ------ ------ ------ ------ ------
<jonasbn@cpan.org>
Copyright (c) 2011-2015 Jonas B. Nielsen, jonasbn. All rights reserved.
Perl::Critic::Policy::logicLAB::RequireSheBang is released under the Artistic License 2.0
The distribution is licensed under the Artistic License 2.0, as specified by the license file included in this distribution.