I couldn't understand from the manual how to use 'inflate'
[prev]
[thread]
[next]
[Date index for 2005/02/04]
I want, for example, the "homepage" (which is non-existant in the main
database) method of Music::Artist to do a search in some other, remote
database and return me the result.
Also when storing to the "homepage" field by writing
$artist->homepage($url), I would like Class::DBI to store $url in that
other, remote database.
I looked in the manual but got no information from it that could lead me.
Should my program look something like this?
====================
package Music::Artist;
use base [...]
__PACKAGE__->has_a(homepage => 'Object::Name',
inflate => sub { return Remote::Table->search( artist => shift
)->first->homepage }
deflate => sub { Remote::Table->search ( artist => shift
)->first->homepage(shift) }
====================
What I wrote above is quite different than the Time::Piece example given
in the Class::DBI manual, because:
1) The Class::DBI documentation example implies that the "homepage"
field exists in the local database (whereas in my case it doesn't)
2) "shift" inside the subs I define would return the value inside the
"homepage" field of the local Artists table (whereas in my case I want
it to return the value inside the primary key of the current record of
the local Artists table)
How do you think I should go about doing this?
Thank you,
- karjala
|
I couldn't understand from the manual how to use 'inflate'
karjala_lists 23:41 on 04 Feb 2005
|