[prev] [thread] [next] [Date index for 2005/06/20]
------=_Part_2316_8455792.1119289673971 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sorry if this is a bit OT, but FromForm does use ClassDBI... And I know sri= =20 is on this list. (Hi sri - Catalyst rocks!) At $work we use accessor_name() to changer the usual accessor/mutator to=20 'get_foo' and 'set_foo'. This patch makes FromForm.pm <http://FromForm.pm>much more flexible about wacky schemes like ours. create_from_form() doesn't have a problem because it's just creating a hashref. There's also a potential bug in _run_update() if you have multiple column= =20 primary keys, but I don't use any tables so I don't have the tuits to do a= =20 proper patch. diff -u FromForm.pm.orig FromForm.pm <http://FromForm.pm> --- FromForm.pm.orig Mon Jun 20 13:41:22 2005 +++ FromForm.pm <http://FromForm.pm> Mon Jun 20 13:40:53 2005 @@ -67,10 +67,10 @@ sub _run_update { my ( $me, $them, $results ) =3D @_; foreach my $col ( keys %{ $results->valid } ) { - if ( $them->can($col) ) { + if ( $them->find_column($col) ) { next if $col eq $them->primary_column; my $val =3D $results->valid($col); - $them->$col($val); + $them->set($col, $val); } } Drew --=20 ---------------------------------------------------------------- Drew Taylor * Web development & consulting Email: drew@xxxxxxxxxx.xxx * Site implementation & hosting Web : www.drewtaylor.com <http://www.drewtaylor.com> *=20 perl/mod_perl/DBI/mysql/postgres ---------------------------------------------------------------- ------=_Part_2316_8455792.1119289673971 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sorry if this is a bit OT, but FromForm does use ClassDBI... And I know sri= is on this list. (Hi sri - Catalyst rocks!)<br> <br> At $work we use accessor_name() to changer the usual accessor/mutator to 'get_foo' and 'set_foo'. This patch makes <a href=3D"http://FromForm.pm"= >FromForm.pm</a> much more flexible about wacky schemes like ours. create_from_form() doesn't have a problem because it's just creating a hashref.<br> <br> There's also a potential bug in _run_update() if you have multiple column primary keys, but I don't use any tables so I don't have the tuits to do a proper patch.<br> <br> diff -u FromForm.pm.orig <a href=3D"http://FromForm.pm">FromForm.pm</a><br> --- FromForm.pm.orig Mon Jun 20 13:41:22 2005<br> +++ <a href=3D"http://FromForm.pm">FromForm.pm</a> Mon Jun 20 13:40:53 2005= <br> @@ -67,10 +67,10 @@<br> sub _run_update {<br> my ( $me, $them, $results ) =3D @_;<br> foreach my $col ( keys %{ $results->valid } ) {= <br> - if ( $them->can($col) ) {<br= > + if ( $them->find_column($col= ) ) {<br> ne= xt if $col eq $them->primary_column;<br> my= $val =3D $results->valid($col);<br> - $them-&= gt;$col($val);<br> + $them-&= gt;set($col, $val);<br> }<br> }<br> <br>Drew<br>-- <br>--------------------------------------------------------= --------<br> Drew Taylor &nb= sp; * Web development & consulting<br> Email: <a href=3D"mailto:= drew@xxxxxxxxxx.xxx">drew@xxxxxxxxxx.xxx</a> * Site i= mplementation & hosting<br> Web : <a href=3D"http://www.drew= taylor.com">www.drewtaylor.com</a> * perl/mod_perl/D= BI/mysql/postgres <br> ---------------------------------------------------------------- ------=_Part_2316_8455792.1119289673971--
[PATCH] Class::DBI::FromForm
|
Generated at 16:36 on 28 Jul 2005 by mariachi v0.52