Re: [CDBI] delete from lookup table

[prev] [thread] [next] [Date index for 2005/10/27]

From: Bill Moseley
Subject: Re: [CDBI] delete from lookup table
Date: 12:44 on 27 Oct 2005
On Thu, Oct 27, 2005 at 10:02:14AM +0200, WulfDirk.Leuschner@xxxxxxxxxxxxxx.xxx wrote:
> 
> The code snippet Bill provided (see below) does the right thing -
> and I did it more or less in the same but a non-generic way by
> providing an extra sub in my USER class.

What I posted was from my form handling code -- it's generic so it
will work with any class I'm updating with a form.  That same
meta_info method is also used to populate the form with options.

> The thing I do not really like about Bill's code is the need to dig
> into the object's hash structure - because there is no method
> available to retrieve the necessary information. I'd rather have a
> somewhat 'cleaner' way of deleting the mapping data.

That would be nice.  I'm using it meta_info so much in my code that
it now feels quite clean and natural...

I suspect other database object mappers provide this ability.



BTW - Looking at what I posted:


> >        # Grab the value from the form field
> >        my $value = $field->value;
> >
> >        # Figure out which values to keep:
> >
> >        my %keep = map { $_ => 1 } ref $value ? @$value : ( $value );

I suspect that should be more like:

           my %keep = map { $_ => 1 } ref $value ? @$value : ( $value )
               if defined $value;



        -- 
        Bill Moseley
moseley@xxxx.xxx


_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

Re: [CDBI] delete from lookup table
Peter Speltz 19:27 on 26 Oct 2005

Re: [CDBI] delete from lookup table
Bill Moseley 20:47 on 26 Oct 2005

Re: [CDBI] delete from lookup table
Peter Speltz 09:22 on 27 Oct 2005

Re: [CDBI] delete from lookup table
Bill Moseley 12:44 on 27 Oct 2005

Generated at 14:18 on 27 Oct 2005 by mariachi v0.52