Loading ...
Sorry, an error occurred while loading the content.

14630Referencing a sub routine

Expand Messages
  • Daniel J. Rychlik
    May 2, 2003
    • 0 Attachment

      Im having a bit of trouble figuring out how to reference a subroutine in perl.

      I have a check_input subroutine that runs a bit of data checking for fields entered in by a user. My problem is, I have multiple subroutines and I only need to check the field names that correspond to its subroutine. In java, we used a get_current_sub function that would check to see what subroutine the program was currently in.

      pusedo code

      if ((getcurrentsubroutine) == the subroutine that i need to check) {

      if ($uname eq '' or $uname =~ /^\s+$/) {
      print_error('User id is missing');
      } # End If

      }# End IF

      elsif ((getcurrentsubroutine) == the subroutine that i need to check) {

      if (check our input for required fields){...} # end if

      } # end ELSIF

      I hope that this is understandable. I appreciate any advice or solution...

      Kind Regards,

      [Non-text portions of this message have been removed]
    • Show all 3 messages in this topic