Return-Path: Delivered-To: apmail-perl-embperl-archive@www.apache.org Received: (qmail 21980 invoked from network); 24 May 2005 19:23:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 24 May 2005 19:23:43 -0000 Received: (qmail 34196 invoked by uid 500); 24 May 2005 19:23:42 -0000 Delivered-To: apmail-perl-embperl-archive@perl.apache.org Received: (qmail 34138 invoked by uid 500); 24 May 2005 19:23:41 -0000 Mailing-List: contact embperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list embperl@perl.apache.org Received: (qmail 34067 invoked by uid 99); 24 May 2005 19:23:40 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=HTML_40_50,HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from Unknown (HELO mail.cdmplus.com) (12.169.58.18) by apache.org (qpsmtpd/0.28) with SMTP; Tue, 24 May 2005 12:23:38 -0700 Received: from [192.168.1.145] by mail.cdmplus.com (AppleMailServer 10.2.3.0) id 386711 via TCP with SMTP; Tue, 24 May 2005 15:21:28 -0400 Mime-Version: 1.0 (Apple Message framework v730) To: embperl@perl.apache.org Message-Id: Content-Type: multipart/alternative; boundary=Apple-Mail-2--931150112 From: Derrick Spell Subject: Subroutine Inheritance Date: Tue, 24 May 2005 15:21:26 -0400 X-Mailer: Apple Mail (2.730) X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --Apple-Mail-2--931150112 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed I want to set up a method accessed from the request object that will allow me the option to create a page title based on the path to the page. What I was thinking was: /base.epl [! sub title { print OUT "Company"; } !] [- $req = shift -] [- $req->title() -] /title.epl [! sub title { print OUT " "; } !] /foo/title.epl [! sub title { my ($self) = @_; $self->SUPER::title(); print OUT " : Products"; } !] /foo/index.html [! sub title { my ($self) = @_; $self->SUPER::title(); print OUT " : Widget"; } !] Then, visiting /foo/index.html would give you a page with the title "Company : Products : Widget". As I went deeper in the directory tree, I could have more title.epl files, and thus a longer title. For instance, if I add: /foo/bar/title.epl [! sub title { my ($self) = @_; $self->SUPER::title(); print OUT " : Downloads"; } !] /foo/bar/index.html [! sub title { my ($self) = @_; $self->SUPER::title(); print OUT " : Widget"; } ! Then the page /foo/bar/index.html would have the title "Company : Products : Downloads : Widget". I can get the inheritance between the /base.epl and whatever index.html page I have working fine. That's no problem. The problem is getting the title.epl involved. I want to use normal Embperl::Object file inheritance for title.epl files, but want it to be inbetween the base.epl and index.html in the heirarchy. Is there a clever way to play with @ISA to accomplish this? Or perhaps someone has a better idea for building titles? -Derrick --Apple-Mail-2--931150112 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1
I want to set up a method = accessed from the request object that will allow me the option to create = a page title based on the path to the page.=A0 What I was thinking = was:

/base.epl
[! sub = title { print OUT "Company"; } !]
[- $req =3D shift = -]
<title>[- $req->title() = -]</title>

/title.epl
[! sub = title { print OUT " "; } !]

/foo/title.epl=A0
[= ! sub title {=A0
=A0 =A0 =A0=A0 =A0my ($self) =3D = @_;
=A0 =A0 =A0=A0 =A0$self->SUPER::title();
=A0 = =A0 =A0=A0 =A0print OUT " : Products";
} !]

/foo/index.html
[! = sub title {=A0
=A0 =A0 =A0=A0 =A0my ($self) =3D = @_;
=A0 =A0 =A0=A0 =A0$self->SUPER::title();
=A0 = =A0 =A0=A0 =A0print OUT " : Widget";
} !]

Then, visiting = /foo/index.html would give you a page with the title "Company : Products = : Widget".=A0 As I went deeper in the directory tree, I could have more = title.epl files, and thus a longer title.=A0 For instance, if I = add:

/foo/bar/title.epl
= [! sub title {=A0
=A0 =A0 =A0=A0 =A0my ($self) =3D = @_;
=A0 =A0 =A0=A0 =A0$self->SUPER::title();
=A0 = =A0 =A0=A0 =A0print OUT " : Downloads";
} !]

/foo/bar/index.html
[! sub title {=A0
=A0 =A0 =A0=A0 =A0my ($self) =3D = @_;
=A0 =A0 =A0=A0 =A0$self->SUPER::title();
=A0 = =A0 =A0=A0 =A0print OUT " : Widget";
} !

Then the page = /foo/bar/index.html would have the title "Company : Products : Downloads = : Widget".=A0 I can get the inheritance between the /base.epl and = whatever index.html page I have working fine.=A0 That's no problem.=A0 = The problem is getting the title.epl involved.=A0 I want to use normal = Embperl::Object file inheritance for title.epl files, but want it to be = inbetween the base.epl and index.html in the heirarchy.=A0

Is there a clever way to = play with @ISA to accomplish this?=A0 Or perhaps someone has a better = idea for building titles?

-Derrick


= --Apple-Mail-2--931150112--