[ic] Perl CGI module (was: Safe error in payment module)

Dan Bergan dan at berganconsulting.com
Thu Nov 15 22:23:44 UTC 2012


On Thu, Nov 15, 2012 at 2:58 PM, Josh Lavin <josh at perusion.net> wrote:
> Quoting Dan Bergan (dan at berganconsulting.com):
>> I was having success with the Net::Braintree module, except for the
>> method that used the CGI module.  So, I created a simple usertag that
>> caused the same error:
>>
>> UserTag test_cgi Order todo
>> UserTag test_cgi addAttr
>> UserTag test_cgi Routine <<EOR
>> use CGI;
>> sub {
>>   my ($todo, $opt) = @_;
>>
>>   my $query_string = $CGI::query_string;
>>   ::logError("test_cgi tag:".__LINE__.": query_string = $query_string");
>>
>>   my $query = CGI->new($query_string);
>>   return $query->Vars;
>> }
>> EOR
>>
>> I placed this usertag in a page called "test.html" and called the
>> page: /cgi-bin/champnew/test.html?test=1
>>
>> Error in the global IC error log:
>>
>>  champnew /cgi-bin/champnew/test.html Died in server spawn: Undefined
>> subroutine CGI::delete
>> >  at (tag 'test_cgi') line 9.
>
> Well, I don't know what that error means, but I don't think you need to
> reference the CGI module in your IC tag. IC provides access to CGI
> parameters already.
>
> Look at any .pm file in lib/Vend/, and search for "%CGI::values" for an
> example.
>

Well, that's the issue... I do need the CGI module.  (The above code
was just to demonstrate the error.)

The Net::Braintree module that I'm using for the payment module uses CGI.

It looks like I could hack the Net::Braintree module to use the
interchange $CGI values, but I would rather keep the code vanilla so I
can upgrade in the future, if necessary.

I'm not a perl expert, so maybe I'm grasping at straws here, but it is
a namespace issue?  I grepped through the source for CGI, and I found
this in Server.pm in the "reset_vars" subroutine:

package CGI;
reset 'A-Z';
reset 'a-z';

Dan



More information about the interchange-users mailing list