subprocess - Verifying Perl Arguments to a Subprocesses -


so beginning perl programmer. have been using month, in last week or have been using other sysadmin type tasks. in doing ran following question,

perl subprocesses flexible, , don't impose many/any constraints on arguments pass in. how possible either enforce number of arguments and/or check whether they're references, scalars etc etc?

to clarify, here's perl subprocesses:

sub mysub{     ($a, $b) = @_;     continue , use these methods  } 

but provides no guarantees $a , $b hold. there anyway make sure contain values, reference $a , scalar $b?

thanks in advance.

edit: when said scalar $b mean containing integer, , not being reference other datastructure.

you can use params::validate module, provides wide possibilities of checking argument list.

in case, like

validate_pos(@_, { type => hashref | arrayref }, { type => scalar }) 

would (note doesn't have single type "ref"). dies when parameters don't match.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -