|
Re: convenience wrapper for looping through columns?: msg#00003lang.perl.modules.dbi.rose-db-object
On 6/1/06, Jonathan Vanasco <rosedb-GYD5gbT+W3w@xxxxxxxxxxxxxxxx> wrote: i did a data::dumper to explore the structure a bit, and there are a That's bad code because it assumes that the column accessor name is the same as the column name, which is not always the case. You also have to decide whether you want a hash of accessor-name/value pairs: foreach my $method ($o->meta->column_accessor_method_names) { $data{$method} = $o->method(); } or a hash of column-name/value pairs: foreach my $column ($o->meta->columns) { my $method = $column->accessor_method_name; $data{$column->name} = $o->$method(); } But what it looks like you're trying to do is clone an object. If that's the case, check out the clone() and clone_and_reset() helper methods in Rose::DB::Object::Helpers. http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Helpers.pm -John ------------------------------------------------------- All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | questions about the manager, Guillermo Roditi |
|---|---|
| Next by Date: | Preview of Rose::DB::Object 0.73, John Siracusa |
| Previous by Thread: | Re: convenience wrapper for looping through columns?, Jonathan Vanasco |
| Next by Thread: | Re: convenience wrapper for looping through columns?, Jonathan Vanasco |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |