[Dbix-class] discard_changes upgrade.

Jonathan Rockway jon at jrock.us
Sun Apr 13 02:15:02 BST 2008


* On Sat, Apr 12 2008, Vladimir Timofeev wrote:

> +    my $hash_ref = $rs->find({
> +        map { $_ => $self->get_column($_) } $self->primary_columns,
> +    }, $attrs);
> +
> +    $self->set_columns($hash_ref);
> +    delete $self->{_dirty_columns};

Is this the only way to do this?  There is an irritating race condition
where the record can go away between initially fetching it and then
refreshing it.  I don't know if much can be done about that (other than
caching the initial state in the row object), but it might be exception
worthy instead of the current code's strategy of just set_columns-ing
nothing (and then erasing the dirty bit).

Also, I object to a variable named $hash_ref :P

Regards,
Jonathan Rockway

-- 
print just => another => perl => hacker => if $,=$"



More information about the DBIx-Class mailing list