cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reinhard Poetz <reinh...@apache.org>
Subject Re: Blocks, Flow and Dependencies [was RE: Splitting xconf files step 2: the sitemap]
Date Tue, 11 Jan 2005 09:35:59 GMT
Torsten Curdt wrote:
>> Problem:
>>
>> flow.js of blockA
>> ------------------
>> function blockAFunc() {
>>   return helper();
>> }
>> function helper() {
>>   return "A";
>> }
>>
>> flow.js of blockB
>> -----------------
>> function blockBFunc() {
>>   return helper();
>> }
>> function helper() {
>>    return "B";
>> }
>>
>>
>> flow.js of blockC
>> -----------------
>> function blockCFunc() {
>>   print(blockB());
> 
> 
> You mean:
> 
> print(blockBFunc());

sorry, yes

>> }
>>
>> What do you expect when you call blockCFun()? A or B?
> 
> 
> Sorry, for the late response
> 
> ...but clearly: B

that's the goal. But with imports in <map:flow/> you will get into  trouble:

<map:flow>
   <map:script src="block:blockA/flow.js"/>
   <map:script src="block:blockB/flow.js"/>
   <map:script src="flow.js"/>
</map:flow>

In this case print(blockBFunc()); will return "A".


> 
>> Answer: It depends on the order of declaring your scripts in 
>> <map:flow/>. The first helper() method declared will be found.
> 
> 
> But there is only one helper() method per block!?

Yes. Therefore we need something more sohpisticated than imports.

-- 
Reinhard

Mime
View raw message