Hi,

I need to do  what set_$rel accomplishes on a many to many relationship.
But I have the additional requirement that I need to know if any items
have changed. 

One implementation is something like this:

sub set_version_types {
    my ($self,@types) = @_;

   # or could use Set::* modules
    my $existing = join '-', sort map { $_->public_id }
$self->version_types;
    my $new      = join '-', sort map { $_->public_id } @types;

    return 0 if $existing eq $new;

    $self->next::method(@types);

    return 1;

}

But I'd like this on generically - eg on all many to many rels. I could
subclass Relationship::ManytoMany, but it's one big method in there.

So my questions are: how best to do this generically, and is a solution
to this useful for DBIC in general?

Thanks,

Richard J.


http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal 
views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on 
it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
                                        

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to