I've been following Neil's awesome tutorial on Embperl Object on a new
project we're working on.
http://perl.apache.org/embperl/IntroEmbperlObject.pod.7.html#Subroutines_in_EmbperlObject
I've been creating subroutines, such as the $req->title() example, that
are initially created by subs.epl which is called in base.epl before the
Execute ('*') call. From the EmpberlObject and Embperl documentation,
these two subroutines are apparently supposed to do the same thing:
[$ sub heading_image $][$ endsub $]
[! sub heading_image { return ""; } !]
However... only the first example, using [$ sub $], works like I want
to.
Am I misunderstanding something?
The [$ $] method works now, but the [! !] syntax looks "cleaner" to me
:-) My goal is to make defaults for heading_text and heading_image that
can be optionally overridden in the actual pages. The important parts of
my Embperl objects are below. When I change the
Execute..inputfile...subs.inc...import call to an Execute call like
init.inc, I get stack overflows.
base.epl:
[- Execute ('constants.inc') -]
[- Execute ('init.inc') -]
[- Execute ({ inputfile => 'subs.inc', import => 1 }) -]
[- Execute ('header.inc') -]
[- Execute ('*') -]
[- Execute ('footer.inc') -]
[- Execute ('cleanup.inc') -]
subs.inc:
[$ sub heading_image $][$ endsub $]
[$ sub heading_text $][$ endsub $]
[$ sub heading $]
[- $req = shift -]
[$ if ($req->heading_image) $]
<img vspace=5 hspace=0 alt="[+ $req->heading_text +]" border=0
src="[+ $req->heading_image +]">
<br>
[$ endif $]
[$ if ($req->heading_text) $]
<h3>[+ $req->heading_text +]</h3>
[$ endif $]
[$ endsub $]
header.inc:
<!-- much snippage of vanilla html code -->
[$ req = shift $]
[- $req->heading() -]
index.epl:
[! sub heading_text {'optionally defined header text'} !]
rest of page...
--
Regards,
Wim Kerkhoff, Software Engineer
Merilus, Inc. -|- http://www.merilus.com
Email: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]