On Wed, Jul 09, 2008 at 05:43:19PM -0400, Perrin Harkins wrote:
> Maybe I'm misunderstanding the way Mason resolves components, but if
> it gets a request for /foo/index.html, won't it look for
> /var/www/common/foo/index.html?  And if it gets /bar/index.html it
> will look for /var/www/common/bar/index.html.  Making both of them
> look for /var/www/common/index.html would require changing the URI
> that Mason is looking up, not the comp_root.

perldoc HTML::Mason::Interp, look for comp_root

particularly:

   [ [ foo => '/usr/local/foo' ],
     [ bar => '/usr/local/bar' ] ]

  This is an array of two-element array references, not a hash. The "keys" for
  each path must be unique and their "values" must be filesystem paths. These
  paths will be searched in the provided order whenever a component path is
  resolved. For example, given the above component roots and a component path of
  /products/index.html, Mason would search first for
  /usr/local/foo/products/index.html, then for
  /usr/local/bar/products/index.html.

So what I'm suggesting is that the handler for /foo be configured like so:

  comp_root => [
    [ foo    => '/var/www/foo' ],
    [ common => '/var/www/common' ],
  ],

When a request comes in for /foo/index.html, Mason looks for the component
'/index.html' in each of the comp_root paths in order; thus, it'll use
/var/www/foo/index.html if it exists, or /var/www/common/index.html, or die.


hdp.

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to