in reply to Re: continuously query
in thread continuously query

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re^3: continuously query
by Marshall (Canon) on Dec 21, 2020 at 18:27 UTC
    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.

      ++ 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.

      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.
Re^3: continuously query
by marto (Cardinal) on Dec 21, 2020 at 17:37 UTC

    For years now you've posted code which doesn't run, or which tells you where problems are. If anyone here is guilty of wasting peoples time, that'd be you. What did you learn from previous questions (one a few posts ago) where you wanted to poll something until a condition is met?

    A reply falls below the community's threshold of quality. You may see it by logging in.
    A reply falls below the community's threshold of quality. You may see it by logging in.
    A reply falls below the community's threshold of quality. You may see it by logging in.