You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Derrick Spell <de...@cdmplus.com> on 2005/05/06 19:46:58 UTC

Embperl_Object_Fallback

I'm having some problems setting Embperl_Object_Fallback correctly.   
What I want to do is allow "virtual urls".  I want to purposely link  
to urls that do not exist.  These urls would logically reside below a  
directory called /catalog.  The Embperl fallback file inside /catalog  
would parse the remainder of the requested url and perform some  
database access based on which url was requested.  In essence, the  
fallback file becomes a directory handler.  However, I only want it  
to handle accesses to directories that are not found.  I was able to  
tweak my settings to send directory requests to my Embperl fallback,  
but it is happening even to valid directories.  Any suggestions?  Yes  
- I could use a query string to produce the same results, but I want  
to achieve the clean look and feel that the user thinks they are  
simply navigating a directory structure.  My configuration is below.


Embperl_AppName           testdeer_embperl_app
Embperl_Object_Base        base.epl
Embperl_UriMatch             "\.htm.?|\.epl|[^\.]*$"
Embperl_Object_Fallback         dhandler.html

<Files *.html>
      SetHandler       perl-script
      PerlHandler      Embperl::Object
      Options            ExecCGI
</Files>
<FilesMatch "[^\.]*$">
         SetHandler      perl-script
         PerlHandler     Embperl::Object
         Options         ExecCGI
</FilesMatch>


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


Re: Embperl_Object_Fallback

Posted by Derrick Spell <de...@cdmplus.com>.
>> I'm having some problems setting Embperl_Object_Fallback correctly.
>> What I want to do is allow "virtual urls".  I want to
>> purposely link to urls that do not exist.  These urls would
>> logically reside below a directory called /catalog.  The
>> Embperl fallback file inside /catalog would parse the
>> remainder of the requested url and perform some database
>> access based on which url was requested.  In essence, the
>> fallback file becomes a directory handler.  However, I only
>> want it to handle accesses to directories that are not found.
>>  I was able to tweak my settings to send directory requests
>> to my Embperl fallback, but it is happening even to valid
>> directories.  Any suggestions?  Yes
>> - I could use a query string to produce the same results, but
>> I want to achieve the clean look and feel that the user
>> thinks they are simply navigating a directory structure.  My
>> configuration is below.
>>
>>
>
> A better way to do this, is to use Embperl application object, e.g.
>
> Embperl_Object_App    myapp.pl
>
> This should conatain some perl code and a sub init, which is called  
> before
> your pages are requested. You can change the filename and do your  
> database
> accesses herein.
>
> See eg/web/epwebapp.pl for an example

I was able to get this working for me using the application object.   
However, there is one caveat for anyone perusing the archives.   
Rather than a full-fledged virtual url, I am only able to get a  
virtual file.  The directory tree in the url must exist, but not  
necessarily the file.  This makes sense because Embperl::Object needs  
a valid directory structure to traverse in order to find the  
application object file.

-Derrick





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


RE: Embperl_Object_Fallback

Posted by Gerald Richter <ri...@ecos.de>.
> 
> I'm having some problems setting Embperl_Object_Fallback correctly.   
> What I want to do is allow "virtual urls".  I want to 
> purposely link to urls that do not exist.  These urls would 
> logically reside below a directory called /catalog.  The 
> Embperl fallback file inside /catalog would parse the 
> remainder of the requested url and perform some database 
> access based on which url was requested.  In essence, the 
> fallback file becomes a directory handler.  However, I only 
> want it to handle accesses to directories that are not found. 
>  I was able to tweak my settings to send directory requests 
> to my Embperl fallback, but it is happening even to valid 
> directories.  Any suggestions?  Yes
> - I could use a query string to produce the same results, but 
> I want to achieve the clean look and feel that the user 
> thinks they are simply navigating a directory structure.  My 
> configuration is below.
> 

A better way to do this, is to use Embperl application object, e.g.

Embperl_Object_App	myapp.pl

This should conatain some perl code and a sub init, which is called before
your pages are requested. You can change the filename and do your database
accesses herein.

See eg/web/epwebapp.pl for an example

Gerald


> 
> Embperl_AppName           testdeer_embperl_app
> Embperl_Object_Base        base.epl
> Embperl_UriMatch             "\.htm.?|\.epl|[^\.]*$"
> Embperl_Object_Fallback         dhandler.html
> 
> <Files *.html>
>       SetHandler       perl-script
>       PerlHandler      Embperl::Object
>       Options            ExecCGI
> </Files>
> <FilesMatch "[^\.]*$">
>          SetHandler      perl-script
>          PerlHandler     Embperl::Object
>          Options         ExecCGI
> </FilesMatch>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
> 
> 


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