You are here: Foswiki>Tasks Web>Item2014 (08 Sep 2009, AndrewJones)Edit Attach

Item2014: Undefined subroutine CGI::remoteAddress at lib/Foswiki/LoginManager/Session.pm

pencil
Priority: Normal
Current State: No Action Required
Released In: 1.0.7
Target Release: minor
Applies To: Engine
Component:
Branches:
Reported By: AndrewJones
Waiting For: Main.AndrewJones
Last Change By: AndrewJones
Got this while installing Kino search. As its a subclass of CGI::Session (shipped with Foswiki) it looks like I need to replace remoteAddress with remote_addr.

Seems too simple a fix, and I don't have unit tests running, but the fix has been working for me so I will commit.

-- AndrewJones - 08 Sep 2009

Why did you do that exactly? I mean, we have:

remote_addr() alias for compatibility with CGI.

KinoSearch is broken, I've never finished the porting work, and neither did WillNorris (who worked on it too iirc).

Why did you change the core to fix a plugin? Gilmar would have to comment on it, but I think this has been named as it is exactly to avoid using the CGI method, but ensure we're calling the Foswiki::Request one.

Personaly, I would revert that and fix KinoSearch.

-- OlivierRaginel - 08 Sep 2009

This change doesn't affect core, but, as Olivier pointed, remote_addr is provided for compatibility with CGI.pm, but core should use remoteAddr, that is aligned with foswiki naming convention.

Please, revert this and fix/port KinoSearch appropriately. Notice that these changes make KinoSearch work only in CGI environment, otherwise it will probably fail.

-- GilmarSantosJr - 08 Sep 2009

Ok sorry about this, I will revert it. But looking through the code (and ignoring Kino), Foswiki::LoginManager::Session is only a small subclass for CGI::Session, right? And CGI::Session does not have the remoteAddress object, so I would have thought if it ever did try to call that object it would fail?

Probably I don't understand the code enough, so I will revert. But im still confused, so if you don't mind explaining it would be helpful for me. Its the only way I will learn smile

-- AndrewJones - 08 Sep 2009

Foswiki::LoginManager::Session is a class to provide to foswiki the same functionality CGI::Session provides to CGI scripts, but it also works on environments other than CGI, cause it uses a Foswiki::Request objetc instead of environment variables to get data.

Since CGI::Session works well, Foswiki::LoginManager::Session is a thin layer over it, that adapts a few methods to make it work on environments other than CGI.

See more details at FoswikiStandAlone.

-- GilmarSantosJr - 08 Sep 2009

Ok thanks Gilmar.

I have reverted the change so will close the task.

-- AndrewJones - 08 Sep 2009

ItemTemplate edit

Summary Undefined subroutine CGI::remoteAddress at lib/Foswiki/LoginManager/Session.pm
ReportedBy AndrewJones
Codebase 1.0.6, trunk
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Engine
Component
Priority Normal
CurrentState No Action Required
WaitingFor AndrewJones
Checkins distro:d0da42c4cfa0 distro:c68c3d41ec7d distro:310f5adfd19f distro:1aea97569c2c
TargetRelease minor
ReleasedIn 1.0.7
Topic revision: r11 - 08 Sep 2009, AndrewJones
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