CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Advanced:
Signal or While loop



Mar 2, 2010, 10:02 AM

Post #1 of 2 (2917 views)
Signal or While loop Can't Post

Hi Perl Gurus,

Let me explain what i am looking for.

I have a perl file say ( This file has a function call getqueryresults().

This getqueryresult does some sql select operation and returns first row of the table.

I have another file called This file has a function called






my $records = getqueryresult();


$records is processed etc etc....

updates to the tables.



now i want the next row to be fetched from getqueryresults() and again call processchild function. My question is how to do this process.

How can i loop the &processchildfunction in the second line to do the process for each and every child.

What is the best approach? infinite while loop or signals or anything else.

Thanks in Advance.

Sha P


Mar 3, 2010, 5:09 AM

Post #2 of 2 (2899 views)
Re: [sha37] Signal or While loop [In reply to] Can't Post

What makes your posting unclear to me is that you *describe* that you want to use the result of getqueryresult() for calling processchild(), but this is not reflected in the code example you gave.

Also, you did not mention whether the interface of getqueryresult() is already fixed, or whether you are free to change it.

Basically, you could either have getqueryresult return a list of all childs and then iterate over the list, or you can write getqueryresult in a way that it accepts a code block, which it invokes for every child. I would do the latter if the number of childs is possibly large (and you don't need to store them anyway), and the former approach if the number of childs is small (less than 1000 or so, depending on how much data is associated with each child).


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives