From c19c02da6c2ecb70e3e9384659b3f1d1e1105ba4 Mon Sep 17 00:00:00 2001 From: miker Date: Sun, 10 Aug 2008 03:53:28 +0000 Subject: [PATCH] allow methods do decide on their strictness; properly parse params text signatures git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1406 9efc2488-bf62-4759-914b-345cdb29e865 --- src/perlmods/OpenSRF/Application.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/perlmods/OpenSRF/Application.pm b/src/perlmods/OpenSRF/Application.pm index dbd86e1..7d438c3 100644 --- a/src/perlmods/OpenSRF/Application.pm +++ b/src/perlmods/OpenSRF/Application.pm @@ -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; -- 2.11.0