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

Your question is not at all clear. I don't know if this is an English as a second language problem or not? If so, tell us about that issue. Many Monks have been responding to you, but either you don't understand what they are saying or you are just ignoring their advice.

Your code is nowhere near close to working. It appears that you are trying to look up order numbers in a DB and then get a JSON doc related to that order? It is unclear what you do after that. next if ($status ne 'NOT-GOOD') { looks like confusing nonsense.  my $ordernumber = $query->fetchrow_array() is wrong. Look at fetchrow_array for the specification of what that method does. Some basic debugging is expected when you post code. print "$ordernumber\n"; before my $url = "link.com/$ordernumber"; would have shown you something important.

Replies are listed 'Best First'.
Re^4: continuously query
by marto (Cardinal) on Dec 21, 2020 at 18:56 UTC

    ++ This is precisely the problem, and you've gone into great detail to explain why this recurring issue prevents proper responses, rather than magical wand waving to fix whatever bigup401 is actually doing.

Re^4: continuously query
by bigup401 (Pilgrim) on Dec 21, 2020 at 22:08 UTC

    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 }

      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.