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 -]
<title>[- $req->title() -]</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


Reply via email to