summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/TUWF.pm4
-rw-r--r--lib/TUWF.pod10
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/TUWF.pm b/lib/TUWF.pm
index 67ae6a3..7966bd2 100644
--- a/lib/TUWF.pm
+++ b/lib/TUWF.pm
@@ -31,6 +31,7 @@ our $OBJ = bless {
my($self, $uri, $msg) = @_;
sprintf "[%s] %s -> %s\n", scalar localtime(), $uri, $msg;
},
+ validate_templates => {},
}
}, 'TUWF::Object';
@@ -46,8 +47,9 @@ sub import {
}
-# set TUWF configuration variables
+# get or set TUWF configuration variables
sub set {
+ return $OBJ->{_TUWF}{$_[0]} if @_ == 1;
$OBJ->{_TUWF} = { %{$OBJ->{_TUWF}}, @_ };
}
diff --git a/lib/TUWF.pod b/lib/TUWF.pod
index 6672145..cc73ea1 100644
--- a/lib/TUWF.pod
+++ b/lib/TUWF.pod
@@ -265,7 +265,9 @@ additional arguments.
=head2 TUWF::set(key => value, ..)
-Set TUWF configuration variables.
+Get or set TUWF configuration variables. When called with only one argument,
+will return the configuration variable with that key. Otherwise the number of
+arguments must be a multiple of 2, setting the configuration parameters.
=over
@@ -438,10 +440,10 @@ will not be called if any of the functions before threw an exception.
=item validate_templates
Hashref, templates for the L<kv_validate()|TUWF::Misc> function when called
-using L<formValidate()|TUWF::Misc>.
+using L<formValidate()|TUWF::Misc>. The recommended way to add new templates is
+to call C<TUWF::set()> with a single argument:
-I<TODO: Having to specify all templates at once does not really promote proper
-code design. Need to find a more flexible way to do this.>
+ TUWF::set('validate_templates')->{$key} = \%validate_options;
=item xml_pretty