perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@metm.org
Subject OO menus
Date Fri, 30 Apr 2004 04:14:03 GMT
I am a bit stuck on a coding issue, so I am thinking outloud, hoping
that the answer will come to me or that I will set off somebody else's
thought process.  

I want to set up a menu system, where all one has to do is modify a file
in the current directory to define the menus for that place in the
directory tree:

_menu.epl: 
@menu = [ item1 , item2 , item3 , item4 ]

item3/_menu.epl:
@menu = [ subitem1, subitem2, subitem3 ]

an embperl html creating widget would produce this :

<ul>
 <li>item1</li>
 <li>item2</li>
 <li>item3
  <ul>
   <li>subitem1</li>
   <li>subitem2</li>
   <li>subitem3</li>
  </ul>
 </li>
 <li>item4</li>

from a data structure that looks like this:

@menu = [ item1 , 
          item2 , 
          [ subitem1 , subitem2 , subitem3 ] , 
		  item3 ,
          item4 ]

I am looking at the end of IntroEmbperlObject.pod with the inslut
example and I imagine this must be possible.  I have been getting stuck
between creating the data structures and calling the superclasses.  I
feel like I want to tinker with Execute cause I don't feel like I
understand the differences between:

  [- Execute('../_menu.epl') -]
  [- Execute({object => '../_menu.epl'}) -]
  [- Execute({isa => '../_menu.epl'}) -]
  [- Execute({inputfile => '../_menu.epl'}) -]

Are there others?  Should I put my data into sub routines like is
shown at times in the docs and the inslut example? 

I want to have the html generating code as a widget called in from the
top-level _base.epl say from _widgets.epl.   I would call with the
subroutine &menu with @menu data structure parameter.  The subroutine
would know how to walk through the structure to print it out.

I am speaking in vauge terms because I feel that I can write each little
piece but I don't quite see how to fit the whole into the embperl framework.

Thanks for any thoughts,

-- 
Marco

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message