Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Re: Class::DBI find_or_create method inserts record but $obj->id is undef

by jerrygarciuh (Curate)
on Jan 24, 2004 at 00:17 UTC ( #323746=note: print w/ replies, xml ) Need Help??


in reply to Re: Class::DBI find_or_create method inserts record but $obj->id is undef
in thread Class::DBI find_or_create method inserts record but $obj->id is undef

Perrin,
Thank you for the reply. Perhaps I am failing to grok how to delete the field from the CGI object, for instance if I do this:

$q->param('class_id') = undef;

I get "Can't modify non-lvalue subroutine call".
Is there some other way to alter the object that will work here?
TIA
jg
_____________________________________________________
"The man who grasps principles can successfully select his own methods.
The man who tries methods, ignoring principles, is sure to have trouble.
~ Ralph Waldo Emerson


Comment on Re: Re: Class::DBI find_or_create method inserts record but $obj->id is undef
Select or Download Code
Replies are listed 'Best First'.
Re: Re: Re: Class::DBI find_or_create method inserts record but $obj->id is undef
by runrig (Abbot) on Jan 24, 2004 at 00:24 UTC
      Mea culpa. Thanks for the reminder I have been away from Perl for a good while.

      Unfortunately the Class::DBI update() method does not work unless the $obj has an id defined and part of the problem here is that the insert id isn't in $obj unless find_or_create gets an explicit undef or an explicit $id.
      TIA
      jg

      _____________________________________________________
      "The man who grasps principles can successfully select his own methods.
      The man who tries methods, ignoring principles, is sure to have trouble.
      ~ Ralph Waldo Emerson
        That's why I said you should delete the value AFTER the call to find_or_create. Alternatively, you could replace your loop with this:
        foreach my $field (grep { $_ ne 'id' } $q->param) {

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://323746]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (15)
As of 2015-07-28 14:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (256 votes), past polls