Skip Menu |

This queue is for tickets about the AppConfig CPAN distribution.

Report information
The Basics
Id: 104
Status: new
Priority: 0/
Queue: AppConfig

People
Owner: Nobody in particular
Requestors: DOUGW [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Allow multiple (array) args on one line of config file.
I wanted to specify in a config file multiple values for an ARGCOUNT_LIST parameter, but instead of having to specify them on multiple lines like so: parameter=value1 parameter=value2 etc. I wanted to be able to specify them on one line like so: parameter=value1, value2 My thinking is that is is best implemented as a patch to the main source (considering what I had to do) rather than a subclass of AppConfig... I implemented this (AFAICT) in a completely backwards compatible way by introducing a 'SPLIT' parameter which is similar to the VALIDATE parameter in that it takes a regex or a code ref, but is used to split up the value(s) on specified parameters ( and if a regex, its the regex used in a split function). E.g. for the above, you might have...SPLIT=>"[,\s]+" If its a code ref, you could use it to split up, e.g. quoted-CSV type parameters (and could be handy in that it can pre-process any parameters): csv_param="This value", "That value", "etc" (diff -ruN patchfiles attached) Let me know what you think,
--- ../AppConfig-1.52/AppConfig.pm Wed Oct 24 14:36:48 2001 +++ AppConfig.pm Tue Nov 27 16:14:07 2001 @@ -464,8 +464,8 @@ =item GLOBAL Reference to a hash array of global values used by default when defining -variables. Valid global values are DEFAULT, ARGCOUNT, EXPAND, VALIDATE -and ACTION. +variables. Valid global values are DEFAULT, ARGCOUNT, EXPAND, SPLIT, +VALIDATE, and ACTION. =item PEDANTIC @@ -588,6 +588,11 @@ other AppConfig variables, EXPAND_UID - expand C<~uid> as user's home directory, EXPAND_ENV - expand C<${var}> as environment variable, EXPAND_ALL - do all expansions. May be logically or'd. + +=item SPLIT + +Regex with which the intended variable value is split or code reference +which a list of values. =item VALIDATE
[guest - Wed Dec 19 15:39:55 2001]: Show quoted text
> I implemented this (AFAICT) in a completely backwards compatible > way by introducing a 'SPLIT' parameter which is similar to > the VALIDATE parameter in that it takes a regex or a code ref, > but is used to split up the value(s) on specified parameters ( > and if a regex, its the regex used in a split function). > E.g. for the above, you might have...SPLIT=>"[,\s]+"
Hmm, I had a patch, but most of it seems to have disappeared during the upload, and I don't have the patch anymore...oh well, maybe I'll try again some day.