allow methods do decide on their strictness; properly parse params text signatures
authormiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Sun, 10 Aug 2008 03:53:28 +0000 (03:53 +0000)
committermiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Sun, 10 Aug 2008 03:53:28 +0000 (03:53 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1406 9efc2488-bf62-4759-914b-345cdb29e865

src/perlmods/OpenSRF/Application.pm

index dbd86e1..7d438c3 100644 (file)
@@ -42,6 +42,12 @@ sub argc {
        return $self->{argc};
 }
 
+sub strict {
+       my $self = shift;
+       return 0 unless ref($self);
+       return $self->{strict};
+}
+
 sub api_name {
        my $self = shift;
        return 1 unless ref($self);
@@ -147,8 +153,7 @@ sub handler {
 
                        my $resp;
                        try {
-                               # un-if(0) this block to enable param checking based on signature and argc
-                               if (0) {
+                               if ($coderef->strict) {
                                        if (@args < $coderef->argc) {
                                                die     "Not enough params passed to ".
                                                        $coderef->api_name." : requires ". $coderef->argc
@@ -327,7 +332,7 @@ sub normalize_whitespace {
 sub parse_string_signature {
        my $string = shift;
        return [] unless $string;
-       my @chunks = split(/\@/so, $string);
+       my @chunks = split(/\@/sog, $string);
 
        my @params;
        my $ret;