HTML::Mason and User site folders

M

macshaggy

I maybe dense, which probably isn't that hard to believe, but I keep
getting this error when accessing a User's sites folder:

[Mason] Cannot resolve file to component: /Users/jbellew/Sites/
index.html (is file outside component root?) at /usr/local/lib/perl5/
site_perl/5.8.8/HTML/Mason/ApacheHandler.pm line 853.

I've commented in the past the Mason::Apachehandler config in
httpd.conf routines to make sure that Mason was having the issue and
it is. It's a basic config at this point but can someone just open my
eyes.

I'm also aware of what Mason is telling me but I can't wrap my brain
around what I should do.

Thanks
J

Sample of httpd.config:
PerlModule HTML::Mason::ApacheHandler
<FilesMatch "\.html$">
SetHandler perl-script
PerlHandler HTML::Mason::ApacheHandler
</FilesMatch>
 
M

Mirco Wahab

macshaggy said:
I maybe dense, which probably isn't that hard to believe, but I keep
getting this error when accessing a User's sites folder:

[Mason] Cannot resolve file to component: /Users/jbellew/Sites/
index.html (is file outside component root?) at /usr/local/lib/perl5/
site_perl/5.8.8/HTML/Mason/ApacheHandler.pm line 853.

I've commented in the past the Mason::Apachehandler config in
httpd.conf routines to make sure that Mason was having the issue and
it is. It's a basic config at this point but can someone just open my
eyes.

I'm also aware of what Mason is telling me but I can't wrap my brain
around what I should do.

Thanks
J

Sample of httpd.config:
PerlModule HTML::Mason::ApacheHandler
<FilesMatch "\.html$">
SetHandler perl-script
PerlHandler HTML::Mason::ApacheHandler
</FilesMatch>

You need to set the "Mason Component root" for
the Apache process:
Example:

PerlModule HTML::Mason::ApacheHandler
...
PerlSetVar MasonCompRoot /Users/jbellew/Sites
PerlSetVar MasonDataDir /var/cache/mason
...
<FilesMatch "\.html$">
SetHandler perl-script
PerlHandler HTML::Mason::ApacheHandler
</FilesMatch>
....


Regards

M.
 
M

macshaggy

You need to set the "Mason Component root" for
the Apache process:
Example:

PerlModule HTML::Mason::ApacheHandler
...
PerlSetVar MasonCompRoot /Users/jbellew/Sites
PerlSetVar MasonDataDir /var/cache/mason
...
<FilesMatch "\.html$">
SetHandler perl-script
PerlHandler HTML::Mason::ApacheHandler
</FilesMatch>
...

Thanks that makes sense. Next question, since when I read your answer
and saw the above example I had to hit myself upside the hed, I need
my Component Root Directory to be set to /usr/local/apache2/htdocs but
still have Mason process files from /Users/jbellew/Sites as well. Can
I have multiple Root directorys?

Thanks again,
J
 
M

Mirco Wahab

macshaggy said:
Thanks that makes sense. Next question, since when I read your answer
and saw the above example I had to hit myself upside the hed, I need
my Component Root Directory to be set to /usr/local/apache2/htdocs but
still have Mason process files from /Users/jbellew/Sites as well. Can
I have multiple Root directorys?

Yes, you can (according to the docs), but
then Mason has to search the target
*on each request* through the different
component roots, because you have address
any Mason component /relative to its
component root.

What exactly do you try to do?
See: http://search.cpan.org/~jswartz/HTML-Mason-1.05/lib/HTML/Mason/Admin.pod#Multiple_component_roots

Regards

M.
 
M

macshaggy

Yes, you can (according to the docs), but
then Mason has to search the target
*on each request* through the different
component roots, because you have address
any Mason component /relative to its
component root.

What exactly do you try to do?
See:http://search.cpan.org/~jswartz/HTML-Mason-1.05/lib/HTML/Mason/Admin....

Regards

M.

Thanks once again and I'll leave this alone when it's working.
Basically I'm trying to setup my system that anytime a person
specifies ~User then Mason will go ahead a serve up that Users html
doc. Otherwise, Mason will continue to serve via the document root. I
don't want it to be specifc to just 1 user but to all that are on the
system.

I'll try this a see if it works otherwise I'm thinking of having a
handler that intercepts the request and expands it for Mason
automatically.

But again thanks for all the help!!
J
 
M

Mirco Wahab

macshaggy said:
Basically I'm trying to setup my system that anytime a person
specifies ~User then Mason will go ahead a serve up that Users html
doc. Otherwise, Mason will continue to serve via the document root. I
don't want it to be specifc to just 1 user but to all that are on the
system.

This scenario is given *exactly* as you described it
in the "Mason Book":

http://www.masonbook.com/book/chapter-11.mhtml#TOC-ANCHOR-15

There is a handler provided, which calls
the Mason handler and sets the proper
component root.

Depending on your naming convention (eg.: ^/~someuser/... ),
you have to modify the example. Then, put this handler
somewhere (where mod_perl can find it) or put it
between <perl> ... </perl> tags in a mod_perl related
Apache config file.

Regards

Mirco
 
M

macshaggy

This scenario is given *exactly* as you described it
in the "Mason Book":

http://www.masonbook.com/book/chapter-11.mhtml#TOC-ANCHOR-15

There is a handler provided, which calls
the Mason handler and sets the proper
component root.

Depending on your naming convention (eg.: ^/~someuser/... ),
you have to modify the example. Then, put this handler
somewhere (where mod_perl can find it) or put it
between <perl> ... </perl> tags in a mod_perl related
Apache config file.

Regards

Mirco

Thanks a bunch, I also found it late last nite. It's exactly what I
need. I had tried the configuration of /Users/*/Sites as I do in the
Apache config to expand but it didn't work. Placing in the Mason
handler is exactly what I thought I would have to do so thanks for
confirming it.

Later - Thanks again
MacShag
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top