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

thanks for your response

here is my full try which i made, its what i want

my $query = $dbh->prepare("SELECT ordernumber FROM orders ORDER BY cre +ated ASC"); $query->execute(); $h_fields = $query->fetchall_arrayref; ####### FUNCATION (A) foreach $r (@{$h_fields}) { $ordernumber = join(", ", @{$r}); # 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"; 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 } redo; # REDO FUNCATION (A) AFTER SUCCESS - ITS LIKE RESTART THE WHOLE + FUNCATION AGAIN # BEACUSE AFTER SUCCESS, I HAVE TO KEEP ALSO CHECKING REAMINING + ORDER NUMBER STATUES }

Replies are listed 'Best First'.
Re^5: continuously query
by GrandFather (Saint) on Dec 21, 2020 at 22:35 UTC

    Are you sure redo is what you want? It repeats the loop without changing $r. As it stands your loop will only ever process the first row you read from the database and will never exit.

    Why are you not using strictures (use strict; use warnings; - see The strictures, according to Seuss).

    Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond
    A reply falls below the community's threshold of quality. You may see it by logging in.