in reply to Re^2: continuously query
in thread continuously query

There are a few issues with your post: Please try to understand and use standard perl "idioms" - they help make code more understandable and avoid bugs.

Here is an idiomatic flow for your case:

my $query = $dbh->prepare("SELECT ordernumber FROM orders ORDER BY cre +ated ASC"); $query->execute(); ####### FUNCATION (A) while( my $row = $query->fetchrow_arrayref() ) { my $ordernumber = $row->[0]; # First, and only field in returned +list # WHEN I PRINT THE OUTPUT IS # 545455 # 745454 # 645450 # NOW I WANT TO CHECK EACH ORDER NUMBER VIA LINK # ITS LIKE I WANT TO RUN HTTP REQUEST FOR EACH ORDER NUMBER my $url = "LINK/$ordernumber"; print "URL: $url\n"; my $req = HTTP::Request->new(GET=>$url); my $resp = $ua->request($req); my $response = JSON::XS->new->decode ($resp->content); my $status = $response->{status}; # WHILE WE GET ORDER NUMBER WITH MATCHING RESLUTS while ( $status eq 'PAID') { #// DO STAFFS HERE #// WHEN DONE THEN KEEP CHECKING OTHER ORDER NUMBER USING REDO } #no redo; # REDO FUNCATION (A) AFTER SUCCESS - ITS LIKE RESTART T +HE WHOLE FUNCATION AGAIN # BEACUSE AFTER SUCCESS, I HAVE TO KEEP ALSO CHECKING REAMI +NING ORDER NUMBER STATUES } $dbh->disconnect();

                "Imaginary friends are a sign of a mental disorder if they cause distress, including antisocial behavior. Religion frequently meets that description"

Replies are listed 'Best First'.
Re^4: continuously query
by bigup401 (Pilgrim) on Dec 22, 2020 at 07:06 UTC

    thank you