Home : Products : Gossamer Links : Development, Plugins and Globals :

Products: Gossamer Links: Development, Plugins and Globals: GT::CGI::param input problem: Edit Log

Here is the list of edits for this post
GT::CGI::param input problem
I'm developing a new plugin, but I did run into a GT::CGI problem.

I get this error:
Can't use string ("Title") as an ARRAY ref while "strict refs" in use at c:/work/cgi-bin/lsql/admin/GT/CGI.pm line 291.

The bug happens at this code:
my %rec_input = map { ($_ =~ /^rec_field(\d+)/) ? ( $IN->param($_) => $IN->param('rec_value' . $1) ) : () } keys %{$IN->params};

Usually the params are passed in array ref:
IN: \bless( {
'params' => {
'LinkOwner' => [ 'value' ],
...
}
}


But when I submit the same plugin page second time (after a missing field content error), there is no array ref anymore in input params:
IN: \bless( {
'params' => {
'Description' => 'Best place to chat about webmaster related topics.',
'LinkOwner' => '',
'func' => 'page_step3_record_add',
'Title' => 'Webmaster',
'URL' => 'http://www.webmaster.com/',
'CatLinks.CategoryID' => '129',
'Contact_Name' => '',
'plugin' => 'my_plugin_name',
'Contact_Email' => '',
'do' => 'plugin',
'do_add_step2' => 'Step 3: Add record'
},
'p' => '',
'nph' => 0,
'_debug' => 0,
'cookies' => {},
'data_loaded' => 1
}, 'GT::CGI' )

I also use HTML object to display field input forms:
my $html = $DB->html ($links_db, $IN);


Could somebody give me idea why does GT::CGI use one time array refs in params, and other time just string?
When first time I post the form, it passes the input values for each field as arrays refs, but after I redisplay the same form because an error (using $DB->html), and repost again the form, the input values for each field are not array refs, just plain scalar values.
Did anybody have similar experience?

I will examine the problem again, if I made any mistake in the code, but if anybody would have idea what is causing the problem, I would appreciate it.

This may be a bug or something?
Any idea is welcomed.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Feb 18, 2004, 4:44 PM

Edit Log: