sub Search { # Search # This subroutine is responsible for searching through the # database for relevant keywords, and to fill an array with # the relevant database entries, In the order they are to be # displayed &openDBhash; # dbaccess.pl # add answers to questions and notes to database &addAnswersAndNotes; # dbaccess.pl # findDataForSearch has to look for questions that match the # keyword identifiers, then it must look for data at these # locations that match the user while pushing the database lines # into an array. &findDataForSearch; # search.pl # sortDataForSearch must review the array and if there are multiple # questions, sortDataForSearch must order the questions properly. # It also must link answers to their respective questions if the # answers exist. User notes will then be placed last in the array. if (!($call{'displayall'})){ &sortDataForSearch; # search.pl } # Now the user may have their own parsing routine, so we'll look # for a special database item that holds this information. This # is set up when either adding a new database or changing user # registration information if ($hash{'3'} eq "true"){ # The programmer will handle printing to Html print "this routine is not implemented yet. hash{'3'} = $hash{'3'}
\n"; } else{ # print our own response html to screen &printHtmlHeader; # htmlroutines.pl if ($call{'displayall'}){ &printAllResponses; } else{ &printSortedArray; # htmlroutines.pl } &printHtmlFooter; # htmlroutines.pl } &closeDBhash; # dbaccess.pl } sub findDataForSearch{ # findDataForSearch has to look for questions that match the # keyword identifiers, then it must look for data at these # locations that match the user while pushing the database lines # into an array. if ($call{'displayall'}){ # User wants all notes and answers # Find all the q's that have a's # put em in an array # print "Nanny Nanny Boo-Boo
\n"; &matchUser; # dbaccess.pl } else{ # user wants location specific Notes and Answers &matchKeywords; # dbaccess.pl } } sub sortDataForSearch{ # sortDataForSearch must review the array and if there are multiple # questions, sortDataForSearch must order the questions properly. # It also must link answers to their respective questions if the # answers exist. User notes will then be placed last in the array. # First Get Questions and put them into an array # Sort the array by the order of questions &getQuestionsForLocation; # parsedata.pl # Print questions to final array, after each question is added, # Search for answers to questions and add them too. &addOrderedQuestionsToArray; # parsedata.pl # print notes to array &addUserNotesToArray; # parsedata.pl } 1;