HTML::Mason and User site folders

Discussion in 'Perl Misc' started by macshaggy, Mar 23, 2007.

  1. macshaggy

    macshaggy Guest

    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>
     
    macshaggy, Mar 23, 2007
    #1
    1. Advertising

  2. macshaggy

    Mirco Wahab Guest

    macshaggy wrote:
    > 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.
     
    Mirco Wahab, Mar 24, 2007
    #2
    1. Advertising

  3. macshaggy

    macshaggy Guest

    On Mar 23, 8:45 pm, Mirco Wahab <> wrote:
    >
    > 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
     
    macshaggy, Mar 24, 2007
    #3
  4. macshaggy

    Mirco Wahab Guest

    macshaggy wrote:
    > On Mar 23, 8:45 pm, Mirco Wahab <> wrote:
    >> ...
    >> PerlSetVar MasonCompRoot /Users/jbellew/Sites
    >> PerlSetVar MasonDataDir /var/cache/mason
    >> ...

    >
    > 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.
     
    Mirco Wahab, Mar 25, 2007
    #4
  5. macshaggy

    macshaggy Guest

    On Mar 25, 5:59 pm, Mirco Wahab <> wrote:
    > macshaggy wrote:
    > > On Mar 23, 8:45 pm, Mirco Wahab <> wrote:
    > >> ...
    > >> PerlSetVar MasonCompRoot /Users/jbellew/Sites
    > >> PerlSetVar MasonDataDir /var/cache/mason
    > >> ...

    >
    > > 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....
    >
    > 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
     
    macshaggy, Mar 26, 2007
    #5
  6. macshaggy

    Mirco Wahab Guest

    macshaggy wrote:

    > 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
     
    Mirco Wahab, Mar 26, 2007
    #6
  7. macshaggy

    macshaggy Guest

    On Mar 26, 4:12 am, Mirco Wahab <> wrote:
    > macshaggy wrote:
    > > 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


    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
     
    macshaggy, Mar 26, 2007
    #7
  8. macshaggy

    Don Salad Guest

    Don Salad, Mar 27, 2007
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mills Thomas (app1tam)

    Anything like Mason in Ruby?

    Mills Thomas (app1tam), Aug 5, 2003, in forum: Ruby
    Replies:
    1
    Views:
    99
    Aredridel
    Aug 6, 2003
  2. Asby

    Mason, DBI, and DBI::Pg

    Asby, Jul 24, 2003, in forum: Perl Misc
    Replies:
    0
    Views:
    177
  3. Terry

    HTML::Mason

    Terry, Mar 7, 2005, in forum: Perl Misc
    Replies:
    1
    Views:
    109
    Eric Schwartz
    Mar 7, 2005
  4. Replies:
    5
    Views:
    367
    J. Gleixner
    Mar 9, 2005
  5. Steve Chapel

    Perl equivalent of PHP and JSP: Mason?

    Steve Chapel, Oct 23, 2005, in forum: Perl Misc
    Replies:
    3
    Views:
    208
    GClef
    Oct 24, 2005
Loading...

Share This Page