[24650] in Perl-Users-Digest
Perl-Users Digest, Issue: 6814 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 3 13:41:43 2004
Date: Tue, 3 Aug 2004 10:41:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 3 Aug 2004 Volume: 10 Number: 6814
Today's topics:
need simple perl script to do secure data transmission <johnrowell@earthlink.net>
Re: need simple perl script to do secure data transmiss <postmaster@castleamber.com>
Re: need simple perl script to do secure data transmiss (Randal L. Schwartz)
Re: need simple perl script to do secure data transmiss <johnrowell@earthlink.net>
new data pagination module (Jonathan buhacoff)
Newbie needs help... (thierry)
Re: Newbie needs help... <mritty@gmail.com>
Re: Newbie needs help... <matthew.garrish@sympatico.ca>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 28 Jul 2004 03:43:04 GMT
From: "John Rowell" <johnrowell@earthlink.net>
Subject: need simple perl script to do secure data transmission
Message-Id: <chFNc.734$9Y6.35@newsread1.news.pas.earthlink.net>
I've been trying to set up a script to transmit credit card info from my
website's secure server directly to the processing organization's server
transparently without the website visitor aware of what's going on. In other
words they should be able to place an order on a secure page on my website,
enter their credit card info, and press a button. Then my website will
transmit this info to the credit card processor, obtain authorization, and
print out a confirmation page to the website visitor. All without the
website visitor being redirected away from my website.
So I have determined that if someone could make up a very small simple
script to do the basic necessary elements, I could use it for testing
purposes and then build up on it and finally have success. Or if someone has
a script that already works for them, and would like to share it with me,
that would be very helpful.
In case it matters, I'm integrating this with Authorize.net via their AIM
implementation. Below is a copy of the script I have been trying to use so
far but have only met with errors:
====================================================
#! /usr/bin/perl
###########################################################
# Please make sure that your using the correct perl #
# location (SHEBANG) for this script to execute #
# properly. Check with your web host. #
###########################################################
###########################################################
# #
# D O C U M E N T A T I O N #
# #
# This CGI/PERL code has been successfully tested on #
# third-party web servers and performed according to #
# documented Advanced Integration Method (AIM) #
# standards. #
# #
# Last updated July 2003. #
# #
# For complete and freely available documentation, #
# please visit the Authorize.Net web site at: #
# #
# http://www.authorizenet.com/support/guides.php #
# #
###########################################################
###########################################################
# #
# When you upload (FTP) this CGI/PERL script to your web #
# server, please make sure that the CHMOD has been set #
# 755. #
# #
# If you are using a command-line tool to assign #
# permissions to this file, please make sure it has read #
# and execute privileges for everyone -- otherwise, the #
# code cannot be excuted. #
# #
###########################################################
###########################################################
# #
# Make sure you have the LWP module installed and verify #
# which version you are using, since you need to #
# reference that version number in your code. #
# #
###########################################################
use LWP 5.64;
use HTTP::Request::Common qw( POST );
###########################################################
# #
# For an easy way to find out which PERL modules are #
# available on your web server, consider the freely #
# available ENV.PL script: #
# #
# ####################################### #
# ## Server Info CGI v1.08 © 2000 ## #
# ## http://www.widexl.com ## #
# ## Made by Henk Boonstra ## #
# ####################################### #
# #
###########################################################
###############################################
# ENTER YOUR LOGIN ID AND PASSWORD HERE #
###############################################
my $auth_net_login_id = "discountwarehouse";
my $auth_net_tran_key = "r50LXSnkQGsVRny4";
my $request_values =
{
x_test_request => "TRUE",
x_login => $auth_net_login_id,
x_tran_key => $auth_net_tran_key,
###########################################################
# #
# Please, pay special attention to the version number. #
# Unless you have a specific reason to make a change, #
# leave it at 3.1. #
# #
# Ideally, you would already have set it to 3.1 in the #
# Merchant Interface to make sure all of your trans- #
# actions will by default follow the 3.1 protocol #
# #
###########################################################
x_version => "3.1",
###########################################################
# #
# Make absolutely sure that you use a delimiter that #
# will not show up in any legitimate name, billing #
# address, product descriptions, etc. #
# #
# For this reason, we prefer using the pipe character: #
# #
# | #
# #
# #
# If necessary, make sure you search for and replace #
# the delimiter character before you accept and process #
# user input -- so that parsing and evaluating the #
# returned string from Authorize.Net will not be #
# negatively affected. #
# #
###########################################################
x_delim_char => "|",
x_delim_data => "TRUE",
x_adc_url => "FALSE",
x_type => "AUTH_CAPTURE",
x_card_num => "4242424242424242",
x_exp_date => "1203",
x_description => "Recycled Toner Cartridges",
x_amount => "12.23",
x_first_name => "Charles D.",
x_last_name => "Gaulle",
x_address => "342 N. Main Street #150",
x_city => "Ft. Worth",
x_state => "TX",
x_zip => "12345",
x_country => "USA",
x_company => "ACME USA",
x_cust_id => "dpb-11937-84065",
x_invoice_num => "0722031200-PM",
x_phone => "1-888-555-1234",
x_fax => "1-888-555-2345",
###########################################################
# #
# NOTE: The @ symbol in the e-mail address must be #
# encoded or else you will have to escape it when you #
# parse the return string in CGI/Perl #
# #
# Instead of @ use @ #
# #
# You don't have to use extensive encoding as shown in #
# this example. #
# #
###########################################################
x_email =>
"customer@cus
16;omer.com",
x_email_customer => "FALSE",
x_ship_to_first_name => "Donovan",
x_ship_to_last_name => "Leitch",
x_ship_to_company => "ACME Explosives & Anvils",
x_ship_to_address => "4567 Wilshire Blvd.",
x_ship_to_city => "Los Angeles",
x_ship_to_state => "California",
x_ship_to_zip => "98765-0987",
x_ship_to_country => "USA",
x_po_num => "1837350987",
x_tax => "6.25",
x_tax_exempt => "TRUE",
x_freight => "11.25",
x_duty => "0.00",
###########################################################
# #
# M E R C H A N T D E F I N E D V A L U E S #
# #
# You can define any number of special, custom fields #
# to have them accompany a transaction. #
# #
###########################################################
CustomerBirthMonth => "12",
CustomerBirthDay => "1",
CustomerBirthYear => "1959",
};
###########################################################
# #
# For the purpose of this demonstration, we have hard- #
# coded a number of values that will get posted to the #
# Authorize.Net payment processor. #
# #
# Obviously, in a real-world e-commerce situation, you #
# would have securely collected most of the data through #
# a shopping cart or by some other means. #
# #
# Moreover, you could have obviously supplied many more #
# values (see the AIM API Guide for specific #
# information), but it varies from merchant to merchant, #
# dependent on their business models, accounting needs, #
# etc. as to which information gets collected. #
# #
###########################################################
###########################################################
# #
# The following four lines demonstrate how to post the #
# transaction data securely to Authorize.Net. #
# You may of course adjust this code to your liking. #
# We simply wanted to provide a working approach to #
# those who don't want to spend a lot of time learning #
# CGI/PERL (or don't have the resources to do custom CGI #
# programming. #
# #
#---------------------------------------------------------#
# NOTE: #
#---------------------------------------------------------#
# For testing purposes, we are submitting all #
# transactions to the certification server. If you have #
# a valid merchant account with Authorize.Net, and if #
# you are done testing, you must post to the actual #
# transaction server, as outlined in your merchant #
# information that you should have received when you #
# opened the Authorize.Net account. #
# #
#---------------------------------------------------------#
# For assistance with your Authorize.Net merchant #
# account, please contact Authorize.Net Customer Support #
# at: #
# 1-877-447-3938 #
#---------------------------------------------------------#
# #
###########################################################
my $useragent = LWP::UserAgent->new( protocols_allowed => ["https"] );
my $request = POST( "https://certification.authorize.net/gateway/transact.d
ll", $request_values );
my $response = $useragent->request( $request );
my @responses = split( /$request_values->{x_delim_char}/,
$response->content );
###########################################################
# #
# The remaining code simply demonstrates how to #
# #
# 1. get to the response string from Authorize.Net #
# 2. how to iterate through the response string to get #
# specific information and display it in a web #
# browser #
# #
# Obviously, you are welcome to add on to the existing #
# code, build your own custom functions to process the #
# information, and so forth. #
# #
# Please keep in mind that we are following the 3.1 AIM #
# standards, as documented. In particular, this means #
# that we are processing the response string from #
# Authorize.Net with regards to the 39th field (Card #
# Code Response) to address CVV2, CVC2 and CID #
# responses. #
# #
###########################################################
print "Content-type: text/html\n\n";
$header = qq|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Authorize.Net AIM Sample in CGI/Perl</title>
<meta name="robots" content="noindex,nofollow">
<style type="text/css">
<!--
BODY {
background-color : #FFFFFF;
font-family: verdana, arial, helvetica, sans-serif;
color : #484848;
font-size : 12px;
scrollbar-face-color: #FFFFFF;
scrollbar-shadow-color: #000000;
scrollbar-highlight-color: #484848;
scrollbar-3dlight-color: #FFFFFF;
scrollbar-darkshadow-color: #000000;
scrollbar-track-color: #8E929D;
scrollbar-arrow-color: #484848;
}
TD {
font-family: verdana, arial, helvetica, sans-serif;
color : #484848;
font-size : 12px;
}
I {
font-family: verdana, arial, helvetica, sans-serif;
color : Red;
font-size : 12px;
}
STRONG {
background-color: transparent;
font-family: verdana, arial, helvetica, sans-serif;
color: #484848;
font-size: 12px;
font-weight: bold;
}
.tdOne{
background-color: #d8d8d8;
}
.tdTwo{
background-color: #eeeeee;
}
.tdThree{
background-color: #eeeeee;
}
-->
</style>
</head>
<body>
|;
$output .= "$header\n\n";
eval {require LWP};
if ($@) {
$output .= "<i>The library www-perl (LWP) is not installed</i><br>\n";
}else{
$output .= "Library www-perl (LWP) v$LWP::VERSION installed<br>\n";
}
$apiresponse .= $response->content . "<br><br>\n";
$endoutput .= "</body></html>\n";
# Error handling (very basic)
if( $response->is_success ){
# Communication was successful
$fback .= "Payment processing successful!<br>";
}else{
$fback .= "We were unable to communicate with the authorizing site. Please
try again.<br>";
}
print "<b>Output:</b> $output";
print "<hr>\n";
print "<b>API response:</b> $apiresponse";
print "<hr>\n";
print "<b>Response:</b> $response";
print "<hr>\n";
print "<b>Result:</b> $fback";
print "<hr>\n";
###########################################################
# #
# We need to split the returned string, using a regular #
# expression to find the pipe character (|). #
# #
# To escape any other meaning of the pipe character in a #
# regular expression, PERL requires the following #
# syntax: #
# #
# /\Q|/ #
# #
# PS: If you prefer another approach to accomplish the #
# same thing, you are of course, welcome to do so. #
# #
# Your feedback would be welcome. Please send us your #
# code improvements by e-mail to: #
# #
# certify@authorize.net #
# integration@authorize.net #
# #
# Thank you. #
# #
###########################################################
$a = 0;
$b = 0;
foreach $pair(@responses){
# The next statement splits based on the pipe character: |
($name,$val) = split(/\Q|/,$pair);
$a++;
}
print "Total number of characters in the Authorize.Net gateway response
string: $a";
print "<hr>\n";
# split the words using the pipe character (|) as the delimiter.
@words = split /\Q|/, $apiresponse;
# get the count of the words
$count = $#words;
print "Total number of separators in the Authorize.Net gateway response
string: $count";
print "<hr>\n";
# print the parsed words on the console, one in each line
print "<table border='0' cellpadding='1' cellspacing='1'>";
for ($i=0; $i <=$count; $i++) {
$ctr = $i+1;
if($ctr==1){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Response Code:";
print "</td><td class='tdTwo' width='5'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==2){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Response Sub-Code:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==3){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Response Reason Code:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==4){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Response Reason Text:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==5){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Approval Code:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==6){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "AVS Result Code:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==7){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Transaction ID:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==8){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Invoice Number:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==9){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Description:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==10){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Amount:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==11){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Method:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==12){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Transaction Type:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==13){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Customer ID:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==14){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Cardholder First Name:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==15){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Cardholder Last Name:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==16){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Company:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==17){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Billing Address:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==18){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "City:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==19){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "State:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==20){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "ZIP/Postal Code:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==21){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Country:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==22){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Phone:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==23){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Fax:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==24){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "E-Mail Address:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==25){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Ship-to First Name:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==26){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Ship-to Last Name:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==27){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Ship-to Company:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==28){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Ship-to Address:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==29){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Ship-to City:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==30){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Ship-to State:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==31){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Ship-to ZIP/Postal Code:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==32){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Ship-to Country:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==33){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Tax Amount:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==34){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Duty Amount:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==35){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Freight Amount:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==36){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Tax Exempt Flag:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==37){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "PO Number:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==38){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "MD5 Hash:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==39){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Card Code Verification Result:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr==40 || $ctr==41 || $ctr==42 || $ctr==43 || $ctr==44 || $ctr==45
|| $ctr==46 || $ctr==47 || $ctr==48 || $ctr==49 || $ctr==50 || $ctr==51 ||
$ctr==52 || $ctr==53 || $ctr==54 || $ctr==55 || $ctr==56 || $ctr==57 ||
$ctr==58 || $ctr==59 || $ctr==60 || $ctr==61 || $ctr==62 || $ctr==63 ||
$ctr==64 || $ctr==65 || $ctr==66 || $ctr==67 || $ctr==68){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Reserved for future use:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}elsif($ctr>=69){
print "<tr class='trOne' valign='top'><td class='tdOne'>";
print "Merchant-defined:";
print "</td><td class='tdTwo'> </td><td class='tdThree'>";
print "@words[$i]\n";
print "</td></tr>";
}else{
print "<tr class='trOne' valign='top'><td class='tdOne' colspan='3'>";
print "$ctr: @words[$i]\n";
print "</td></tr>";
}
}
print "<tr class='trOne' valign='top'><td class='tdOne'
colspan='3'> </td></tr>";
print "</table>";
print "<hr>\n";
print "$endoutput";
====================================================
------------------------------
Date: Wed, 28 Jul 2004 00:17:50 -0500
From: John Bokma <postmaster@castleamber.com>
Subject: Re: need simple perl script to do secure data transmission
Message-Id: <410736fe$0$207$58c7af7e@news.kabelfoon.nl>
John Rowell wrote:
> In case it matters, I'm integrating this with Authorize.net via their AIM
> implementation. Below is a copy of the script I have been trying to use so
> far but have only met with errors:
Which are...
> }elsif($ctr==40 || $ctr==41 || $ctr==42 || $ctr==43 || $ctr==44 || $ctr==45
> || $ctr==46 || $ctr==47 || $ctr==48 || $ctr==49 || $ctr==50 || $ctr==51 ||
> $ctr==52 || $ctr==53 || $ctr==54 || $ctr==55 || $ctr==56 || $ctr==57 ||
> $ctr==58 || $ctr==59 || $ctr==60 || $ctr==61 || $ctr==62 || $ctr==63 ||
> $ctr==64 || $ctr==65 || $ctr==66 || $ctr==67 || $ctr==68){
What an amazing piece of eh code :-D
--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: 27 Jul 2004 23:05:52 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: need simple perl script to do secure data transmission
Message-Id: <864qnsis3j.fsf@blue.stonehenge.com>
>>>>> "John" == John Bokma <postmaster@castleamber.com> writes:
John> What an amazing piece of eh code :-D
It would not even be fair of me to suggest that the company that wrote
this horrid piece of code is also the company I spoke of in:
<http://www.stonehenge.com/merlyn/LinuxMag/col49.html>
wherein I said:
Now I won't embarass the service provider by giving their name,
but they really did a pretty poor job of designing and documenting
their service. First, their ``sample Perl code'' could never have
run, as they were using + to do string concatenation. (It was
apparently copied from their JavaScript example, except they
weren't paying attention.) Second, they return something that is
nearly XML, but has extra leading and trailing whitespace, so a
true XML parser aborts. (You have to trim the whitespace before
feeding the parser.) And finally, they return XML, but they're not
using SOAP, which seems odd because it looks like a natural SOAP
application. So, if you can get around the fact that their example
programs don't run, the response requires massaging before
parsing, and it's not SOAP, it works fine.
so I will not.
print "Just another Perl hacker,"; # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Wed, 28 Jul 2004 19:32:35 GMT
From: "John Rowell" <johnrowell@earthlink.net>
Subject: Re: need simple perl script to do secure data transmission
Message-Id: <nbTNc.1304$cK.1197@newsread2.news.pas.earthlink.net>
I know, it's a real nightmare to sort through. At least this segment is
understandable, if not efficient. But so much of the script is illogical and
a lot is impossible for me to sort through. Isn't there another sample
script that is available for free to send transactions to AuthorizeNet? Or
at least doesn't anyone have code snippets? I realize it would be best if I
didn't have to work with this sample script, but it's the only one I have.
Since thousands of websites are processing credit cards through
AuthorizeNet's AIM system, there's gotta be other scripts out there....
--John
"John Bokma" <postmaster@castleamber.com> wrote in message
news:410736fe$0$207$58c7af7e@news.kabelfoon.nl...
> John Rowell wrote:
>
> > In case it matters, I'm integrating this with Authorize.net via their
AIM
> > implementation. Below is a copy of the script I have been trying to use
so
> > far but have only met with errors:
>
> Which are...
>
>
> > }elsif($ctr==40 || $ctr==41 || $ctr==42 || $ctr==43 || $ctr==44 ||
$ctr==45
> > || $ctr==46 || $ctr==47 || $ctr==48 || $ctr==49 || $ctr==50 || $ctr==51
||
> > $ctr==52 || $ctr==53 || $ctr==54 || $ctr==55 || $ctr==56 || $ctr==57 ||
> > $ctr==58 || $ctr==59 || $ctr==60 || $ctr==61 || $ctr==62 || $ctr==63 ||
> > $ctr==64 || $ctr==65 || $ctr==66 || $ctr==67 || $ctr==68){
>
> What an amazing piece of eh code :-D
>
> --
> John MexIT: http://johnbokma.com/mexit/
> personal page: http://johnbokma.com/
> Experienced Perl programmer available: http://castleamber.com/
> Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: 27 Jul 2004 17:28:58 -0700
From: jonathan@buhacoff.net (Jonathan buhacoff)
Subject: new data pagination module
Message-Id: <a55fd8ee.0407271628.75563603@posting.google.com>
I have an online catalog of items that I want to split up into several
pages.
I looked at the following modules on CPAN:
HTML::Paginator
Data::Paginated
Data::Page (also: Data::Pageset, Data::SpreadPagination)
And they work fine but I guess I just don't like their style. I
created my own very lightweight module to do the same job, but without
keeping track of the current page, without screwing around with my CGI
environment, and without generating any HTML.
It's fully documented, right now it's called Data::SimplePaginator
but I'm wondering if anyone has suggestions for a better name. An
11-character safe alternative is Data::Paginator::Simple.
Jonathan Buhacoff
------------------------------
Date: 28 Jul 2004 14:58:51 -0700
From: thierry@iconless.com (thierry)
Subject: Newbie needs help...
Message-Id: <a8b1845c.0407281358.1211f0e8@posting.google.com>
Hi,
I am learning perl, and I have some questions regarding a script I am
studying .
Here is a portion of my script :
my (@sargs) = @_;
is it equivalent with : my @sargs = @_; ? (without bracket)
After there is :
my $config = {"delete" => 0, soFiles => []};
Is it right that $config is a hash table ?
I have a doubt, because I would write : my %config = ( "delete" => 0,
soFiles => [] );
is these 2 lines are equivalent ?
my $config = {"delete" => 0, soFiles => };
my $config = {"delete" => 0, "soFiles" => };
After that, delete is initialized like this :
$config->{delete} = 1; # why -> is it a reference ?
why not to use : $config{delete} = 1 ?
Thanks for your help. And sorry for these questions...
thierry
------------------------------
Date: Wed, 28 Jul 2004 18:37:41 -0400
From: Paul Lalli <mritty@gmail.com>
Subject: Re: Newbie needs help...
Message-Id: <20040728183036.T3404@barbara.cs.rpi.edu>
On Wed, 28 Jul 2004, thierry wrote:
> Hi,
>
> I am learning perl, and I have some questions regarding a script I am
> studying .
> Here is a portion of my script :
> my (@sargs) = @_;
>
>
> is it equivalent with : my @sargs = @_; ? (without bracket)
It will help to get your terminology correct.
() => Parentheses
[] => Brackets
{} => Braces
To answer the question, yes, those statements are equivalent. The
parenteses are unnecessary in this case.
> After there is :
> my $config = {"delete" => 0, soFiles => []};
> Is it right that $config is a hash table ?
Not quite, no. $config is a reference to a hash, not an actual hash.
Read perldoc perlref for more info on references.
> I have a doubt, because I would write : my %config = ( "delete" => 0,
> soFiles => [] );
That would be a hash.
> is these 2 lines are equivalent ?
>
> my $config = {"delete" => 0, soFiles => };
> my $config = {"delete" => 0, "soFiles" => };
Yes. The => operator is actually a different way of writing a simple
comma, with one important exception: it automatically quotes any bareword
on its left. Note that this works only for a single bareword, however.
In other words these two are *not* equivalent:
my %c = ( 'foo bar' => 0 );
my %c = ( foo bar => 0 );
and the second one will in fact give an error.
> After that, delete is initialized like this :
>
> $config->{delete} = 1; # why -> is it a reference ?
Yes. As mentioned above, $config is a hash reference, not a hash. The ->
operator is the method for dereferencing a reference and accessing an
element of the resulting hash.
> why not to use : $config{delete} = 1 ?
That's how you would access the 'delete' key of a hash named %config. But
you didn't have a hash named %config. You had a hash reference named
$config.
Paul Lalli
------------------------------
Date: Wed, 28 Jul 2004 18:29:00 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Newbie needs help...
Message-Id: <LMVNc.22$U_3.11672@news20.bellglobal.com>
"thierry" <thierry@iconless.com> wrote in message
news:a8b1845c.0407281358.1211f0e8@posting.google.com...
> Hi,
>
> I am learning perl, and I have some questions regarding a script I am
> studying .
> Here is a portion of my script :
> my (@sargs) = @_;
>
> is it equivalent with : my @sargs = @_; ? (without bracket)
>
Yes. The parens are just noise in this case. They are necessary if you were
trying to assign the values to scalars, for example:
my ($var1, $var2, $var3) = @_;
But, there's no need to force list context on an array as you're doing
above.
> After there is :
> my $config = {"delete" => 0, soFiles => []};
> Is it right that $config is a hash table ?
> I have a doubt, because I would write : my %config = ( "delete" => 0,
> soFiles => [] );
>
$config is not a hash, but a scalar that contains a reference to an
anonymous hash. You can create named hashes the way you're doing, or create
anonymous ones using braces (and scalars!). The big difference (aside from a
name) lies in how you access the values. In your named hash, you would
simply write $config{'delete'}, whereas in the anonymous hash you would
first have to dereference the reference: $$config{'delete'}.
>
> is these 2 lines are equivalent ?
>
> my $config = {"delete" => 0, soFiles => };
> my $config = {"delete" => 0, "soFiles" => };
>
Yes, but more noise. There is no reason to use double quotes around the keys
(see perlfaq7).
>
> After that, delete is initialized like this :
>
> $config->{delete} = 1; # why -> is it a reference ?
>
As I mentioned above, $config contains a reference.
> why not to use : $config{delete} = 1 ?
>
As I mentioned above, you can also use $$config{'delete'}. Either way, you
have to derefence reference. If the above worked, how would you
differentiate between %config and the anonymous hash in $config?
Time you got started on the perldocs and perlfaqs if you want a more
complete explanation (in particular: perldata, perlreftut and perlref).
Matt
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 6814
***************************************