> > sub handler {
>
> > my $r = shift;
> > my $uri = $r->uri;
> > ... detecting dynamic handlers ...
> > while( my($url, $dirs) = each %STATIC_FILES ) {
> > if( $uri =~ m{$url/(.*)$} ) {
> > foreach my $d (@$dirs) {
> > my $file = "$d/$1";
> > if( -f $file ) {
> > $r->filename($file);
> > return OK;
> > }
> > }
> > }
> > }
> > }
>
> ah, a real-world example. Just what we need. Care to write a short pod
> section using this example, explaining the problem and the solution?
> plain text or pod will do. we will add it to the coding chapter.
Hmm, let's use my english-like language...
The problem:
- the application static files are installed in /myapp/img,
/myapp/css, ...
- local site customization can be made by installing customized files
in /custom/img, /custom/css...
- in both cases they are accessed via /img/..., /css/... urls
The solution - we use custom transhandler to check whether the
customized version exists and use it if so.
--
( Marcin Kasperski | Working overtime sucks the spirit and motivation )
( http://www.mk.w.pl | out of a team. (Wells) )
(----------------------------------------------------------------------------)
( O CVS i zarządzaniu wersjami: http://www.mk.w.pl/narzedzia/narzedzia_cvs )