Re: CGI::Minimal and Cookies
Re: CGI::Minimal and Cookies
am 18.12.2007 17:51:48 von xhoster
Ben Morrow wrote:
> Quoth xhoster@gmail.com:
> > Ben Morrow wrote:
> > > Quoth John Bokma :
> > > > From the documentation of CGI::Minimal: "See 'CGI::Cookie' for
> > > > cookie generation". Which sounds like a lot of fun, except that
> > > > CGI::Cookie does:
> > > >
> > > > use CGI;
> > > >
> > > > Which probably makes use CGI::Minimal pointless. Or am I wrong?
> > >
> > > Which version? I have 1.26 here, and it doesn't use CGI. It does use
> > > CGI::Util, which contains a group of routines for doing URI-escaping
> > > and such; maybe older versions just used CGI instead, and the code's
> > > been refactored?
> >
> > I see it there, in the next line after the use CGI::Util. Maybe you
> > deleted use CGI in your local copy?
>
> No, certainly not... :)
> Further investigation reveals that line was added in CGI::Cookie 1.27,
> in CGI.pm-3.17.
It looks like they added it in CGI-3.16, but forgot to update the version
in Cookie, so it still says it is 1.26. Or maybe I don't understand how
these bundle things work.
> I wonder why...
It looks like when they added the "bake" method, they made it use a method
from CGI, so added it.
Unfortunately you can't prevent a "use" from happening via subclassing.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
Re: CGI::Minimal and Cookies
am 18.12.2007 18:57:22 von John Bokma
xhoster@gmail.com wrote:
> Unfortunately you can't prevent a "use" from happening via
> subclassing.
I've already considered creating a nearly empty CGI.pm, and making sure
it's loaded first >:->.
Anyway, I contacted the author, and hopefully it's fixed in the near
future. It's not that urgent (to me).
--
John
Arachnids near Coyolillo - part 1
http://johnbokma.com/mexit/2006/05/04/arachnids-coyolillo-1. html
Re: CGI::Minimal and Cookies
am 18.12.2007 19:58:12 von Ben Morrow
Quoth xhoster@gmail.com:
> Ben Morrow wrote:
>
> It looks like they added it in CGI-3.16, but forgot to update the version
> in Cookie, so it still says it is 1.26. Or maybe I don't understand how
> these bundle things work.
Yes, it does. Bad Lincoln, no cookie. (SCNR)
It's annoying, especially since $cookie->bake is AFAICS equivalent
to $CGI->header(-cookie => $cookie), and the docs for CGI::Cookie state
it can be used independantly.
> > I wonder why...
>
> It looks like when they added the "bake" method, they made it use a method
> from CGI, so added it.
>
> Unfortunately you can't prevent a "use" from happening via subclassing.
{
local $INC{'CGI.pm'} = $0;
use CGI::Cookie;
}
perhaps with a
{
package CGI;
use autouse CGI => 'header';
}
as well. Of course, it will break if you call the ->bake method, so
don't do that.
Ben
Re: CGI::Minimal and Cookies
am 18.12.2007 20:20:40 von John Bokma
Ben Morrow wrote:
> Quoth xhoster@gmail.com:
>> Ben Morrow wrote:
>
>> Unfortunately you can't prevent a "use" from happening via
>> subclassing.
>
> {
> local $INC{'CGI.pm'} = $0;
> use CGI::Cookie;
> }
>
> perhaps with a
>
> {
> package CGI;
> use autouse CGI => 'header';
> }
>
> as well. Of course, it will break if you call the ->bake method, so
> don't do that.
Heh, since I bake my cookies via Template::Toolkit (Set-Cookie: ... in (my
own) http_headers.tt), I don't care about that. Thanks for the work-around
suggestions.
--
John
Arachnids near Coyolillo - part 1
http://johnbokma.com/mexit/2006/05/04/arachnids-coyolillo-1. html