Greetings Perl Pro's,
I am an long time admin, but a novice when it comes to Perl. I have a canned script from a CC auth provider, and am trying to modify it to make it a bit more useful. Below is the sample code, (sanitized, of course). I'm sure I just need a quote somewhere or something. I have googled my brains out trying to find a sample of something that looks like this that I could learn from, but I am just coming up empty. I really do plan on sitting down with a good book one day and learning Perl.. I just have too many things on my plate right now.
Anyway, any suggestions would be much appreciated.
# This script is the second half of a two-parter.
# The first script uploads credit card info (over SSL, of course)
# to the processor. This second script will then retrieve the
# results of the batch, using the batchId provided as output
# from the first script. The default script has you putting the
# batchId into the actual code. While this would work, it just
# doesn't seem quite as clean as it should be. In intend to
# tie these scripts to an internally developed application,
# written in another language. That app will just call the
# first script for processing, pick up the output, then call
# this second script to get the results of the batch.
require HTTP::Request;
require LWP::UserAgent;
use HTTP::Request::Common;
$ua = LWP::UserAgent->new;
$url = '$url .= 'echo_id=<your_merchant_id_here>&';
$url .= 'merchant_pin=<your_merchant_pin_here>&';
$url .= 'batchId=<batch_number_to_retrieve_here>';
#$url .= 'batchId=$ARGV[0]'; #This is what I was attempting instead, with no luck
$response = $ua->request((GET $url), 'results.txt');
if ($response->is_success)
{
print $response->content;
}
else
{
print $response->error_as_HTML;
}
print "Command-line arguments: @ARGV"; #I added this line to prove that the ARGV is getting populated properly
I am an long time admin, but a novice when it comes to Perl. I have a canned script from a CC auth provider, and am trying to modify it to make it a bit more useful. Below is the sample code, (sanitized, of course). I'm sure I just need a quote somewhere or something. I have googled my brains out trying to find a sample of something that looks like this that I could learn from, but I am just coming up empty. I really do plan on sitting down with a good book one day and learning Perl.. I just have too many things on my plate right now.

# This script is the second half of a two-parter.
# The first script uploads credit card info (over SSL, of course)
# to the processor. This second script will then retrieve the
# results of the batch, using the batchId provided as output
# from the first script. The default script has you putting the
# batchId into the actual code. While this would work, it just
# doesn't seem quite as clean as it should be. In intend to
# tie these scripts to an internally developed application,
# written in another language. That app will just call the
# first script for processing, pick up the output, then call
# this second script to get the results of the batch.
require HTTP::Request;
require LWP::UserAgent;
use HTTP::Request::Common;
$ua = LWP::UserAgent->new;
$url = '$url .= 'echo_id=<your_merchant_id_here>&';
$url .= 'merchant_pin=<your_merchant_pin_here>&';
$url .= 'batchId=<batch_number_to_retrieve_here>';
#$url .= 'batchId=$ARGV[0]'; #This is what I was attempting instead, with no luck
$response = $ua->request((GET $url), 'results.txt');
if ($response->is_success)
{
print $response->content;
}
else
{
print $response->error_as_HTML;
}
print "Command-line arguments: @ARGV"; #I added this line to prove that the ARGV is getting populated properly