[Maypole] Re: Non-insignificant add/update issues
Simon Cozens
simon@simon-cozens.org
Mon, 1 Mar 2004 15:39:04 +0000
(Maybe we should be using the list, for Maypole discussions, to archive
this sort of thing for posterity.)
Jesse Sheidlower:
> I renamed my "slang_user" table to "user" to avoid this problem for now.
Well, you shouldn't need to, but I think we need to avoid or redefine
"moniker" so that it uses the same rules as CDBI::Loader.
> When I try to add a new anything (not just a user), Maypole dies
> with a "Can't use an undefined value as an ARRAY reference at...
> CDBI.pm line 38", this being the line in do_edit that goes
> my ($obj) = @{$r->objects};
It doesn't go like that in CVS. :)
> I'm not clear why this would show up empty.
This happens because when you create a new entry the URL will be
/foo/do_edit/, the args slot will be empty, and so "->objects" will also be
empty. The latest version in CVS uses a belt-and-braces approach to ensure
that ->objects is always at least an array reference, and that CDBI.pm does
not unconditionally dereference it.
I always wonder whether these things should return a proper list rather
than a reference anyway.
> I'm also getting weirdness when I try to edit an entry. Simply,
> the entry does not update. I've set up untaint_columns and such,
> and when I do an update, the "warn "Updating an object ($obj)""
> line of do_edit [which should, I expect, ultimately be pulled,
> as it's debugging code]
It should, yes, but not until we've finished debugging things like this. :)
> shows that the correct values are being
> set for the object. However, the object does not update, and
> there are no errors shown.
I've seen this when the untaint columns aren't properly specified,
but I'm not sure what to do if they are. Can you check that whatever
is specifying the untaint_columns is actually being called?
> Is there some commit that needs to be performed, or something that
> needs to be set? I'll send any code or error messages that would be
> helpful.
There shouldn't be a need for a commit, since it all works for me.
--
Be not anxious about what you have, but about what you are.
-- Pope St. Gregory I