mitbeaver has asked for the wisdom of the Perl Monks concerning the following question:
The problem: I'm creating an autosubmit script for a user to sign up for multiple advertising options. Most of the sites have image verification, and currently I use perl to retrieve the image, display it in the browser, and have the user complete the image verification himself to abide by the robot rules. Most sites have been trivial with the use of AJAX and Mechanize. However, one site uses the src for the image as a .php file. Most image verification files are simply jpgs that when refreshed simply muddle up the same text in a different way. But the php file obviously continually changes. So I need the file to appear on my page (which I have been doing with saving the page, pattern matching the picture, and sending back the picture address).
Proposed Solution #1 (didn't work): Print out the image, and add a while loop that sleeps until the ajax creates the file that has the user input. -> Script never prints, and is affected by the "forever" loop.
Proposed Solution #2 (50% working): Print out the image, and add a userprompt in perl. -> Prints the image fine, but of course, the userprompt doesn't flow through to HTML or JS. I could see this working if perl had a function that allowed the userprompt to flow through straight to a JS alert.
If anyone can help me out I would really appreciate it. I can send some sample code if it would help, but I think its pretty straight forward
Comment on Waiting for user input to complete CGI perl script execution
The way this is typically done is with a session of some sort that stores user data and allows you to retrieve it one the next call... this could be anything from a simple file with a code in it to whole Perl hashes stored away.