[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] Problem with param


My guess is you've got "use CGI qw(:standard);" in your code.  CGI.pm
has a param method that gets imported and overrides the C::A param
method if you use :standard option for CGI.pm.  Omit that and see if
the problem goes away.

This drove me absolutely crazy when first learning C::A.  In fact, I
never did figure this out until I saw a post a few months ago on the
list from someone having the same problem as you.  I created my own
param method (not called param by the way) in my app to get around
this since.  In my opinion, it would be nice if C::A provided an alias
to param that's not called 'param'.

--Rhet

You have a very subtle problem in the above code.  CGI.pm has a
'param' method, and you are importing that 'param' method with the
':standard' import group of functions.  So when you call $self->param,
you are actually getting the param method from CGI.pm.  So removing
the use CGI statement will fix your problem.

On 7/2/05, Cesar Alba <suppressed> wrote:
> Hi,
> 
> I've upgraded my desktop to Fedora Core 4 and, after a lot of work
> making CGI's work (security issues), I've run into a PERL problem with
> passing parameters.
> 
> I had a code in my previous OS (Fedora Core 3) that worked propoerly.
> 
> This snippet used to work. It's taken from the documentation page
> ---------------
> $webapp->param('CONFIG'=>\%CONFIG,
>                'PARAM'=>\%PARAM,
>                );
> ----------------
> 
> But now, when I try to retrieve the value of the parameter 'CONFIG' I
> just get the string 'CONFIG' so a code like this
> my %CONFIG=%{$self->param('CONFIG')};
> doesn't work.
> 
> If I call $webapp->param(), it returns an array with all parameter
> names and values.
> ---------------
> print STDERR Dumper($self->param())
> $VAR1 = 'CONFIG';
> $VAR2 = {
>            'URLBASE' => 'http://sitid.cpd.hi.inet/fotos/',
>            'LDAP_HOST' => 'localhost:38900',
>           'LDAP_BASE' => 'o=TID'
>         };
> $VAR3 = 'PARAM';
> $VAR4 = {};
> --------------
> 
> I can get a workaround of this but I guess something is broken
> somewhere. Has anyone the same problem? Any idea of how can it be
> fixed?
> 
> My system runs:
> perl -V
> Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
>   Platform:
>     osname=linux, osvers=2.4.21-27.0.2.elsmp, archname=i386-linux-thread-multi
>     uname='linux decompose.build.redhat.com 2.4.21-27.0.2.elsmp #1 smp
> wed jan 12 23:35:44 est 2005 i686 i686 i386 gnulinux '
> 
> And the CGI::Application I am using is:
> $CGI::Application::VERSION = '4.01';
> 
> --
> Thanks
> César
> 
> ---------------------------------------------------------------------
> Web Archive:  http://www.mail-archive.com/suppressed/
>               http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
> To unsubscribe, e-mail: suppressed
> For additional commands, e-mail: suppressed
> 
>

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.