Monks ~
I'm building a module, one of whose jobs is parsing input. It's been pointed out to me that input parsing has been done before :) and I'm looking for a way to be more constructively lazy about it. At the same time, I want to avoid a disease that has plagued me lately: multiple nested dependencies.
Perl folks I know here in Portland dot the spectrum from "Never use dependencies other than what comes with the default install," to "Who cares if it's a 3-year-old .01?" My own position on that scale varies depending on how obscure the dependency is, how much work it saves me, how much value it adds, and other such things. I've seen other discussions of this issue here, so feel free to skip that part of my question if you're bored with it.
Right now the module depends on CGI and nothing else; the module I'm thinking of using is Damian's (now Abigail's) Regexp::Common.
So my questions:
Here's a simplified snip of the code I have now:
sub valex { my $self = shift; $_ = shift; /^integer$/ and return qr/\d+/; /^word$/ and return qr/\w+/; # etc. return undef; }
Using Regexp::Common would replace the qr//s above. The benefits are a richer and more robust set of regexen: Damian and Abigail have wicked Perl-fu. The drawbacks are added complexity and a dependency of perhaps questionable value (for this application: notice I have no heartache using CGI :).
(NOTE) I don't care how easy or difficult it is for me to install dependencies, but one of the design goals is to avoid interface complexity in common situations. I very much want users of the module to be able to specify plain words as validators: 'integer', 'email', etc. So I'd be wrapping the common regexen with the valex sub anyway, and only using Regexp::Common internally. I have confidence (and so far my test suite agrees with me) that I can write or find these myself.
Thanks for your time and replies.
In reply to Dependencies, or, How Common is Regexp::Common? by legLess
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |