Oct 14, 2012, 5:16 AM
Post #1 of 1
calling class methods, determined at runtime (ORLite)
I am trying to make a crm application with a lot of crud actions. So I have controller classes like
No I use ORLite as a lite weight ORM. It creates -on the fly- classes like so
Now say I want to load a city. In the CRM::Cities class I do something like
$obj1 = Model::Cities->load($id);
To load the current country in CRM::Countries:
$obj1 = Model::Countries->load($id);
So I end up in each crm-controller class to enclose similar lines.
What I would want to be able todo is to do something generic like this in the CRM package (the superclass):
$obj1 = Model::$package->load($id);
#where $package is Cities or Countries ...
I tried with various variations , with eval and so on but this is higher order perl. I think b/c the ORLite methods are class methods, inheritance is less obvious. Can someone give advice? tia !