You are here: Foswiki>Tasks Web>Item8895 (10 May 2010, GeorgeClark)Edit Attach

Item8895: Module "CGI" is present but not displayed in the Configure - Web Server Environment - Perl Modules

pencil
Priority: Normal
Current State: Closed
Released In: 1.1.0
Target Release: n/a
Applies To: Engine
Component:
Branches:
Reported By: GeorgeClark
Waiting For:
Last Change By: GeorgeClark
Some later versions of CGI appear sensitive to the string CGI and don't display it if it's the only content in CGI::th.

Babar and CDot on #foswiki came up with the solution:

 $ perl -MCGI -wle'print CGI::th("CGI")'
<th />
 $ perl -MCGI -wle'print CGI->th("CGI")'
<th>CGI</th>

further consultation with CDot, th expects the first variable to either be a hash, or a string. Calling as ->th passes in $class as the first parameter. Passing in an explicit hash as the first parameter is a better solution.

 $ perl -MCGI -wle'print CGI::th({},"CGI")'
<th>CGI</th>

Also need to look for other calls and correct if necessary.

-- GeorgeClark - 12 Apr 2010

This is a design issue. Since CGI.pm is designed to work as a procedural or OO module, all its functions/methods need to verify if the first parameter is an object (blessed reference), the CGI string (to handle static methods calls, like CGI->p("foo bar")) or anything else.

So, if the first parameter to some CGI.pm function not called as a method can be the string CGI, then the call should be rewritten as a static method call.

Because things like this, I'm considering to replace CGI.pm by CPAN:HTML::Tiny, for example. But it will be another proposal. wink

-- GilmarSantosJr - 12 Apr 2010

Yeah, CGI is a piece of crap and should really be avoided. Not to mention it's huge for nothing.

Even though I strongly disagree with CDot's statement that CGI::th({},"CGI") is better than CGI->th("CGI") (I think OO, so calling a class method, is better than calling a function from another module), I don't care about the fix smile

But I agree with Gilmar, it would be nice if we could look into using something else. The only advantage of CGI.pm is that some twisted mind thought it was a good idea to bundle it with perl, so it's now dual-life, but at least available in all the recent perl.

-- OlivierRaginel - 10 May 2010

This appears fixed by Crawford's changes. Changing status to closed.

-- GeorgeClark - 10 May 2010
 

ItemTemplate edit

Summary Module "CGI" is present but not displayed in the Configure - Web Server Environment - Perl Modules
ReportedBy GeorgeClark
Codebase trunk
SVN Range
AppliesTo Engine
Component
Priority Normal
CurrentState Closed
WaitingFor
Checkins distro:f01537721deb distro:63137fce4db8 distro:48cae90a880e
TargetRelease n/a
ReleasedIn 1.1.0
Topic revision: r9 - 10 May 2010, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy