[cgiapp] Re: Unexpected variable persistence with CAD / CADS
George Hartzell
hartzell at alerce.com
Sat Oct 25 13:09:11 EDT 2008
Richard Jones writes:
> George Hartzell wrote:
> > You didn't actually provide a broken example, so I cobbled one
> > together that I think does what you're describing, but it doesn't
> > exhibit the problems you've described.
> >
> > I've stuck a shar archive of a little app on the end of this message.
> >
> > http://localhost:8080/foo/update/2
> >
> > followed by
> >
> > http://localhost:8080/foo/new_record
> >
> > does not seem to have a stuck id value.
> >
> > Does it have the problem on your system?
> >
> > If not, can you figure out how to make it have the problem?
>
> Yes!! Just put a PARAMS entry in Dispatch:
>
> sub dispatch_args {
> return {
> table => [
> ':app/:rm' => { },
> ':app/:rm/:id' => { },
> ],
> args_to_new => {
> PARAMS => { foo => 'bar' }, # <= comment to change behaviour
> },
> };
> }
>
> Your example app. will now exhibit the described behaviour just using:
>
> http://localhost:8080/foo/new_record
> http://localhost:8080/foo/new_record/123
> http://localhost:8080/foo/new_record
>
> Even an empty PARAMS arg (PARAMS => {}) switches on variable
> persistence. See also the debug output to console to see the id param
> presence in every request.
>
> Not sure if this is the intended behaviour, but presumably means it's
> not possible to use the PARAMS arg in args_to_new - at least not without
> being very careful and fully aware of the consequences.
> [...]
Yeah, args_to_new and CAD::Server have issues. You may remember the
last time they bit you:
http://lists.openlib.org/pipermail/cgiapp/2008q3/000656.html
and
http://lists.openlib.org/pipermail/cgiapp/2008q3/000695.html
I think that the shared thought of that thread was that CA::Server
should be fluffed up a bit to include some functionality that folks
wanted and then CAD::Server should be retired.
To that end I fixed what folks were asking for, patch thread starting
here (with a bit of self-commentary in the following posts):
http://lists.openlib.org/pipermail/cgiapp/2008q3/000695.html
and we're waiting for a new CA::Server release w/ bated breath.
g.
More information about the cgiapp
mailing list