cross
New Foswiki release 2.1.6 is available with important security fixes.
Sourceforge foswiki email lists being discontinued. Subscribe to the new Foswiki announce and discuss lists at MailingLists
This question about Installation of Foswiki: More info required

Undefined subroutine Foswiki::Request::rearrange

I have been successfully using 1.1.9. I downloaded 2.0.2, resolved missing perl modules and now I get
Undefined subroutine Foswiki::Request::rearrange

when I try foswiki/Main (or System or whatever) or bin/configure. Nothing is written in event.log or the apache log. I am running OSX Yosemite. I don't know what to do next to complete the installation and move my topics to 2.0.2.

-- TheodoreMankovich - 24 Oct 2015

Can you find out what version of CGI and perl is installed? It appears that Perl is getting confused and trying to call Request::rearrange instead of CGI::Util::rearrange. The following diff makes it explicit, and should avoid the issue.

diff --git lib/Foswiki/Request.pm Foswiki/Request.pm
index 071c736..949c790 100644     
--- lib/Foswiki/Request.pm
+++ lib/Foswiki/Request.pm
@@ -264,7 +264,7 @@ Reasonably compatible with CGI corresponding method. Doesn't support
 sub url {
     my ( $this, @p ) = @_;
 
-    my ( $relative, $absolute, $full, $base, $path_info, $query ) = rearrange(
+    my ( $relative, $absolute, $full, $base, $path_info, $query ) = CGI::Util::rearrange(
         [
             qw(RELATIVE ABSOLUTE FULL BASE), [qw(PATH PATH_INFO)],
             [qw(QUERY_STRING QUERY)],
@@ -455,7 +455,7 @@ sub multi_param {
 sub param {
     my ( $this, @p ) = @_;
 
-    my ( $key, @value ) = rearrange( [ 'NAME', [qw(VALUE VALUES)] ], @p );
+    my ( $key, @value ) = CGI::Util::rearrange( [ 'NAME', [qw(VALUE VALUES)] ], @p );
 
     # param() - just return the list of param names
     return @{ $this->{param_list} } unless defined $key;
@@ -504,7 +504,7 @@ sub cookie {
     eval { require CGI::Cookie; 1 } or throw Error::Simple($@);
     my ( $this, @p ) = @_;
     my ( $name, $value, $path, $secure, $expires ) =
-      rearrange( [ 'NAME', [qw(VALUE VALUES)], 'PATH', 'SECURE', 'EXPIRES' ],
+      CGI::Util::rearrange( [ 'NAME', [qw(VALUE VALUES)], 'PATH', 'SECURE', 'EXPIRES' ],
         @p );
     unless ( defined $value ) {
         return keys %{ $this->{cookies} } unless $name;
@@ -607,7 +607,7 @@ Foswiki::Response =header= method.
 
 sub header {
     my ( $this, @p ) = @_;
-    my ( $key, @value ) = rearrange( [ 'NAME', [qw(VALUE VALUES)] ], @p );
+    my ( $key, @value ) = CGI::Util::rearrange( [ 'NAME', [qw(VALUE VALUES)] ], @p );
 
     return keys %{ $this->{headers} } unless $key;
     $key =~ tr/_/-/;

If your system has the "patch" utility installed, you can save this patch to a file named request.patch in the root of your foswiki installation. Then execute the following command:
patch -p0 < request.patch

-- GeorgeClark - 24 Oct 2015

Thanks. Some progress but not there yet. I applied the patch successfully. Now it gives me: Undefined subroutine &CGI::Cookie::unescape called My CGI is 3.63 perl is 5.18.2

-- TheodoreMankovich - 25 Oct 2015

I have no idea what's going on. CGI::Cookie::unescape() is actually CGI::Util::unescape, and it's the same patched above, but this time internal to CGI::Cookie. CGI::Cookie calls unescape and perl is picking up the wrong location. But since it's internal to CGI, I don't have a patch to suggest.

-- GeorgeClark - 25 Oct 2015

I had to install CGI::Session for 2.0.2. I used cpanm. It installed version 4.48. CGI.pm (version 3.63) on the other hand came with OSX and it is located in /System/Library/Perl/5.18. Session was installed in /Library/WebServer/Documents/Foswiki-2.0.2/lib/CPAN/lib/perl5/CGI/Session.pm. Is there some incompatability there. Maybe I should install all the needed CGI modules from cpanm. Should I try that?

-- TheodoreMankovich - 25 Oct 2015
 

QuestionForm edit

Subject Installation of Foswiki
Extension
Version Foswiki 2.0.2
Status More info required
Related Topics
Topic revision: r5 - 25 Oct 2015, TheodoreMankovich - This page was cached on 23 Jun 2018 - 11:56.

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