Home : Documentation : Embperl::Object
Google Web perl.apache.org

 
Home
 
Features
 
Introduction
 
Documentation
 
README
 
README.v2
 
Configuration
 
Embperl
 
Embperl::Object
 
Embperl::Form::Validate
 
Embperl::Syntax
 
Embperl::Recipe
 
Embperl::Mail
 
1.3.6 documentation
 
DBIx::Recordset
 
Installation
 
Download
 
Support
 
Changes
 
Wiki
 
More infos
 
Add info about Embperl
 
Login

    Stable 2.4.0
    Beta 2.5.0_3
Support the development of Embperl! More...
Basic Example
[ << Prev: Execute ] [ Content ] [ Next: Example for using method calls >> ]

With the following setup:

 <Location /foo>
    PerlSetEnv EMBPERL_OBJECT_BASE base.htm
    PerlSetEnv EMBPERL_FILESMATCH "\.htm.?|\.epl$"
    SetHandler perl-script
    PerlHandler Embperl::Object 
    Options ExecCGI
 </Location>

Directory Layout:

 /foo/base.htm
 /foo/head.htm
 /foo/foot.htm
 /foo/page1.htm
 /foo/sub/head.htm
 /foo/sub/page2.htm

/foo/base.htm:

 <html>
 <head>
 <title>Example</title>
 </head>
 <body>
 [- Execute ('head.htm') -]
 [- Execute ('*') -]
 [- Execute ('foot.htm') -]
 </body>
 </html>

/foo/head.htm:

 <h1>head from foo</h1>

/foo/sub/head.htm:

 <h1>another head from sub</h1>

/foo/foot.htm:

 <hr> Footer <hr>

/foo/page1.htm:

 PAGE 1

/foo/sub/page2.htm:

 PAGE 2

/foo/sub/index.htm:

 Index of /foo/sub

If you now request http://host/foo/page1.htm you will get the following page

  
 <html>
 <head>
 <title>Example</title>
 </head>
 <body>
 <h1>head from foo</h1>
 PAGE 1
 <hr> Footer <hr>
 </body>
 </html>

If you now request http://host/foo/sub/page2.htm you will get the following page

  
 <html>
 <head>
 <title>Example</title>
 </head>
 <body>
 <h1>another head from sub</h1>
 PAGE 2
 <hr> Footer <hr>
 </body>
 </html>

If you now request http://host/foo/sub/ you will get the following page

  
 <html>
 <head>
 <title>Example</title>
 </head>
 <body>
 <h1>another head from sub</h1>
 Index of /foo/sub
 <hr> Footer <hr>
 </body>
 </html>

 

[ << Prev: Execute ] [ Content ] [ Next: Example for using method calls >> ]

© 1997-2012 Gerald Richter / ecos gmbh