From a444512bf1e31d15bb88a9679a01de9b6c8f4e93 Mon Sep 17 00:00:00 2001 From: Juerd Waalboer Date: Sun, 25 Dec 2022 05:33:24 +0100 Subject: [PATCH] Enable Perl warnings for plugins --- UPGRADING.md | 14 +++++++++++++- lib/RevBank/Plugins.pm | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/UPGRADING.md b/UPGRADING.md index 684cf45..7c846ca 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -51,7 +51,7 @@ It is now possible to add products to products, which is done by specifying product. This can be used for surcharges and discounts, or for bundles of products that can also be bought individually. -### Eplicit contra accounts +### Explicit contra accounts By default, products sold via the `products` plugin, are accounted on the `+sales/products` contra account. This can now be overridden by specifying @@ -77,6 +77,18 @@ would be crazy or wouldn't make sense in a self-service environment. RevBank was too limited to support it properly, but I think current RevBank fulfills all requirements for making a better, proper pfand plugin. +## Perl warnings are now enabled for plugins + +If you get Perl warnings from a plugin, and don't want to fix the issues with +the code (or disagree with the warning), just add "no warnings;" to the top of +the plugin file. However, the warnings are often indicative of suboptimal code +that is ground for improvement! + +Most warnings will be about unitialized (undefined) values. Some guidance for +Perl newbies: you can test whether something is defined with `if +(defined($foo)) { ... }`, or provide a default value with `$foo // "example +default value"`. + # (2022-08-30) RevBank 3.5 RevBank now has a simple built-in text editor for products and market; diff --git a/lib/RevBank/Plugins.pm b/lib/RevBank/Plugins.pm index b2c64e2..2bc4086 100644 --- a/lib/RevBank/Plugins.pm +++ b/lib/RevBank/Plugins.pm @@ -52,6 +52,7 @@ sub load($class) { } RevBank::Eval::clean_eval(qq[ use strict; + use warnings; use feature qw(signatures); no warnings 'experimental::signatures'; package $package;