Class::DBI::FromCGI and is_changed
[prev]
[thread]
[next]
[Date index for 2004/10/26]
Hi all,
I am using Class::DBI::FromCGI to update some user preferences. Updating
is happening fine but I need to detect when the user has submitted the
form without changing any of the fields.
I thought that I could use ->is_changed but that thinks that the fields
*have* been changed, maybe by the act of untainting them ?
Is that the expected behaviour or have I done something silly ? In the
event of the former, is there any way to work out what has actually
changed other than by comparing the fields in a foreach loop before trying
the update ?
Many thanks,
Simon.
The code looks like:
$user->update_from_cgi( $h => { required => \@must_have,
all => \@columns_to_update } );
if (my %errors = $user->cgi_update_errors) {
$user->discard_changes;
die( Template::Exception->new( 'DATA-ERROR',
\%errors ));
}elsif ( $user->is_changed ){
warn "updated : ".join( ':', $user->is_changed )."\n";
$user->update;
#$user->dbi_commit;
return 1;
}else{
#nothing changed !
return 0;
}
|
Class::DBI::FromCGI and is_changed
Simon Wilcox 12:45 on 26 Oct 2004
|