dnmfarrell / Sub-Attributes

Meta programming with subroutine attributes
https://metacpan.org/pod/Sub::Attributes
Other
1 stars 1 forks source link

:lax and :strict options #1

Open opendevnet opened 8 years ago

opendevnet commented 8 years ago

First issue! So let me say thanks for this module!

I'm not sure if the feature in the subject line would be useful or how strictly "enforced" these sorts of errors should be. Arguably fatal is good. In a simple version of these options :strict (current behaviour and default) would use croak and :lax would use carp.

opendevnet commented 8 years ago

Rationale: Sometimes logging errors but not failing right away helps? :-)

Or maybe import/export options could make errors more flexibly configurable so that Sub::Attributes could be bolted onto the functions and methods in existing code for tests. Just how well an application works when method/function separation is implemented this way would be a neat thing to test if was easy to do ;-)

dnmfarrell commented 8 years ago

Interesting idea, I hadn't thought about strict / warnings etc. It might be nice to make a feature like this generic, e.g. strict and warnings are pragmas, Carp is a module so what about a use attribute?

sub foo :Use(strict warnings Carp) { ... }