
I'm not gonna describe what I'm doing (it's not the scope of the post ;)) (unless you really want to know of course.) (but I think it suffices to tell you I'm doing it so Lieven doesn't have to do a lot of work ;)) But a possible solution would be to wrap the return of __call into an array, which gets passed by value, thus copying the reference of the result with it ;) The problem is then that the returned result is .. well .. wrapped in an array ;) (maybe I can write another __call to remove this ? ;)) [release] => Array ( --==> [0] => Array <==-- this level is unnecessary! ( [Picpa] => Array ( [release] => 666666 [start_locus] => chr1-1_0002 ) ) ) Kenny ps: maybe I'm just nitpicking here .. ;) pps: ok, this is what I'm doing: cakePHP handles database access gracefully. You can ask things to your table (model) like "find('all', 'matching these conditions')". Now, I simply made sure that, if you ask a question (function) to a model, and the function doesn't exists, it get's forwarded to the webservice .. This makes for a transparent use of models on the website. (I don't have to make a difference between what is in cake and what is in perl). (You see why I want to have it in 1 goddamn technology?) On Tue, 3 Feb 2009, Thomas Abeel wrote:
WTF are you trying to do?
Usually if you see more than one time "magic" or "automagically" in the description of a piece of software, you known you're in trouble. Especially in combination with catch all+wrappers that allow you to leave stuff undefined. Do you even expect this to work?
Sorry, no solution ;-)
Kenny Billiau wrote:
Hi,
with the introduction of magic methods in php5, you could have a catch-all function called __call($function, $args) to kick in as soon as no matching function was found for a call. This is great, as I can write one baseclass with default functionality.
Secondly, in the main program I had something like this:
$q = start_event_queue(); $result1 = $q->push(an_event); $result2 = $q->push(another_event); ... $q->fire_events();
The $result# where references to the actual results, so they didn't get a relevant value before fire_events is fired. This is great too.
Thirdly, I wrapped above functionality so the events don't have to be defined .. even at runtime (yeah yeah, don't trip on this one ..). So I use the magic method __call to catch these. And here comes the problem...
The magic method __call doesn't return by reference! (ARGG!) There's even a 4 year old bug report about it: http://bugs.php.net/bug.php?id=30959&edit=1 Does anyone have an idea how I could automagically remove that extra level, or how I could administer the perfect solution illustrated in 'secondly'.
So, the question is: what the easiest way to administer this problem.
-Kenny ps: djeezes, what an explanation. pps: the Francis/Stephane solution: "Actually, we need to rewrite php to basicly fit perl better"
-- ================================================================== Kenny Billiau Web Developer Tel:+32 (0)9 331 36 95 fax:+32 (0)9 3313809 VIB Department of Plant Systems Biology, Ghent University Technologiepark 927, 9052 Gent, BELGIUM kenny.billiau@ugent.be http://bioinformatics.psb.ugent.be ================================================================== "The price good men pay for indifference to public affairs is to be ruled by evil men." -Plato