Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^4: continuously query

by bigup401 (Pilgrim)
on Dec 21, 2020 at 22:08 UTC ( [id://11125579]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11125579]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2024-04-20 04:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found