I want to make it easier to reduce boilerplate.
One of my clients had a rule that every Perl module has a standard set of boilerplate at the top of every Perl package/script. I changed that to:
use Client::Policy;
That made life much easier. I do this a lot for clients and I don't want to keep doing that. However, there were fiddly bits in writing that module. I'd rather write this:
use feature 'policy';
policy;
And that reads a .perlpolicy file and automatically injects its contents into the current code.
So if .perlpolicy contains this:
use v5.26;
use warnings;
use feature "signatures';
no warnings 'experimental::signatures';
use Carp qw(carp croak);
You don't have to write that every time.
However, we need to consider how the .perlpolicy file is located, and handling the case where you might want different policies for different parts of your code. For example, for Tau Station, we have `Veure::Module`, `Veure::Moose`, and `Veure::Script` depending on our needs. Or if you update Perl, maybe have incremental policies based on the version of Perl?
policy; # default
policy 'script';
policy 'Moose';
This solves a common problem, but I have not yet thought out all of the implications, so I'd love feedback.
Best,
Ovid
--
IT consulting, training, specializing in Perl, databases, and agile development
http://www.allaroundtheworld.fr/.
Buy my book! - http://bit.ly/beginning_perl
One of my clients had a rule that every Perl module has a standard set of boilerplate at the top of every Perl package/script. I changed that to:
use Client::Policy;
That made life much easier. I do this a lot for clients and I don't want to keep doing that. However, there were fiddly bits in writing that module. I'd rather write this:
use feature 'policy';
policy;
And that reads a .perlpolicy file and automatically injects its contents into the current code.
So if .perlpolicy contains this:
use v5.26;
use warnings;
use feature "signatures';
no warnings 'experimental::signatures';
use Carp qw(carp croak);
You don't have to write that every time.
However, we need to consider how the .perlpolicy file is located, and handling the case where you might want different policies for different parts of your code. For example, for Tau Station, we have `Veure::Module`, `Veure::Moose`, and `Veure::Script` depending on our needs. Or if you update Perl, maybe have incremental policies based on the version of Perl?
policy; # default
policy 'script';
policy 'Moose';
This solves a common problem, but I have not yet thought out all of the implications, so I'd love feedback.
Best,
Ovid
--
IT consulting, training, specializing in Perl, databases, and agile development
http://www.allaroundtheworld.fr/.
Buy my book! - http://bit.ly/beginning_perl