Hi
On Sat Apr 18 23:01:13 2009, m-uchino@yetipapa.com wrote:
Show quoted text> 3.
> At line 704.
> The undef is NOT 'defined data', then query() called, and the new
> query-object is generated in query().
> * empty-string is 'defined data'.
Yes, you are correct.
I did not appreciate that the call to query() at line 705 would generate
a new CGI object.
Of course, if you are trying to use CGI::Simple or some other module,
instead of CGI, that creates another problem :-(.
Show quoted text> The old version doesn't support generation new CGI-object. Therefore old
> version generates new ID even if whichever is specified(empty-string or
> undef).
> I think that, it is convenient that a new version generates new
> CGI-object, but the programmer must know this information when he wants
> safe new ID.
OK. Here's what I suggest as a change to the POD:
--------------
A special situation arises when the expression $query||$sid evaluates to
false:
=over 4
=item A new CGI object is created
Of course, if you are trying to use CGI::Simple or another module,
instead of CGI, this might create a new problem,
since this new object is stored inside the current CGI::Session object.
Also, early versions of this module did not do this, so this change in
behaviour might be confusing.
=item This new object is asked to provide a SID
Of course, the SID returned by this new object will be empty.
=item The current CGI::Session object then generates a new SID
This is what you wanted.
However, if you already have, or later create, a CGI - or similar -
object, you need to be aware that the current CGI::Session
object is now using its own CGI object. This will almost certainly lead
to confusion.
=back
So, the recommended way to avoid this is to always call new() with
either a query object or a sid, so that the expression
$query||$sid is never false.
---------
I've changed my own SVN version of the code to contain this patch.
However, before checking it in I will wait for comment from other
developers.
As for the module creating a object of type CGI and not of some other
type, there's nothing we can do, because when the user does not provide
a query object, we have no way of knowing what type of object they prefer.