There are a few issues with your post:
- It would help if you provide SHORT, RUNNBLE CODE that demonstrates the issue
- It would help if code were indented properly - that would allow others to see loop boundaries
- You have misunderstood how to process the return value from fetchall_arrayref
- You have a syntax error in "while ( $status eq 'PAID') ) {"
- Your "redo" will not work the way you seem to expect
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"
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.