ewitch has asked for the wisdom of the Perl Monks concerning the following question:

I am moving a Perl CGI script from one server (Perl 5.005 w/CGI.pm 2.46) to another (Perl 5.8.0 w/CGI.pm 2.94 -- latest) and am noticing some strange behavior with CGI::XMLForm (both servers have version 0.10 of that module) It starts out like this:
use CGI::XMLForm; my $q = new CGI::XMLForm;
Then various parameters from the HTTP POST are added, deleted, modified in $q by a subroutine. Back in "main" after the subroutine, when I dump out the parameters & values from $q I get output like this:
Name: /strega/header/id Value: 519 Name: /strega/header/type Value: P Name: /strega/header/options Value: exe_opt.dat Name: /strega/header/file Value: prod.xml.dat
I know these will produce appropriately tagged & nested XML. But then when I try to convert it to XML like this: $finalXML = $q->toXML; ... when I print out $finalXML, the XML gets generated based on the original $q parameters and values, not the ones that have been cleaned up. And oddly enough it works on the old platform. I have tried cloning $q but run into a different problem. I have a feeling I am making a mistake related to handling of objects in perl. Can anyone help? Thanks.

Replies are listed 'Best First'.
Re: CGI::XMLForm and modified query parameters
by benn (Vicar) on Jun 14, 2003 at 10:12 UTC
    I think you're going to have to post some code, as there aren't many clues here. Possibly it's something to do with passing your $q back and forth to a subroutine - are you sure you're maipulating the same object? Impossible to tell though without seeing.

    Cheers, Ben.