I hope to design an interface of a function like this (not in OO way) :

sub tell_error
{ print "Error for @_" }

sub Check_err
{ my %argv = @_; 
    ....
    ....
 }

Check_err  ( TYPE => [1, 1, \&tell_error('Type')], DATA => [ 1, 2, \&tell_error 
('Data')] );

In Check_err, I want &tell_error ('Type') runs when ${argv{TYPE}}[0] & 
${argv{TYPE}}[1] both == 1
but do nothing if that's not the case... $argv{DATA} also doing the same thing...
What I've wrote make tell_error directly run before I go inside Check_err... Any 
pointers ?
Must I pass in a $scalar code and eval it ?

Thanks in advise.


Reply via email to