[rt-users] Site-specific customization of RT
darren chamberlain
darren at boston.com
Tue Mar 26 11:12:12 EST 2002
Hi folks.
I hope I can be helpful here; it took me a long time to figure out
how Mason does things, and where/when the local component root is
used. Granted, it's been a few years since I've seriously looked
at the internals of HTML::Mason, but this should all still be
fairly accurate.
Quoting Smylers <smylers at gbdirect.co.uk> [Mar 26, 2002 10:12]:
> On Friday I wrote:
> > You can put things under these directories:
> >
> > rt/local/WebRT/html/
> > rt/local/lib/
> >
> > If a file of the same name exists in the local and non-local
> > directories, the local one will be used.
>
> That was my understanding of the purpose of rt/local/, but
> appears not to be the case. It works for html/, but not lib/.
That's because the local thing is for HTML::Mason's component
root only, and has nothing to do with perl. See below for a more
detailed explanation.
> I've easily made it work for lib by editing each of the files
> in rt/bin from having these two lines:
>
> use lib "/usr/local/rt/lib";
> use lib "/usr/local/rt/etc";
>
> to these three:
>
> use lib "/usr/local/rt/lib";
> use lib "/usr/local/rt/local/lib";
> use lib "/usr/local/rt/etc";
This will work, although for completely different reasons than
the reasons that local works for html files and Mason components.
> * What should be in rt/local/ then? If rt/local/lib/ isn't the done
> thing then the only content of that directory is rt/local/WebRT/,
> and the only content of _that_ directory is rt/local/WebRT/html/,
> and I don't see the point of having two extra levels of hierarchy
> that don't contain anything.
Note that the way HTML::Mason works is that components will be
looked for in local, not HTML files called by Apache. (A
component in Mason-speak is anything that is invoked using the
<& &> syntax.)
Here's an abbreviated look at how HTML pages are served through
HTML::Mason: The browser requests a URI, Apache turns it into a
path on the system, and then Apache passes control to
HTML::Mason (in the form of the RT::Mason package, which is
defined in your webmux.pl script), which parses/executes that
file. During the execution of that file, HTML::Mason quite often
has to look in other places on the filesystem for components;
this is where local comes in. HTML::Mason will look in the local
hierarchy for things it includes.
There are some fudges in there; HTML::Mason has things called
autohandlers and dhandlers, which can take over at various spots
in the parsing/execution stage, and which are HTML::Mason
specific.
So why does the second "use lib" line above work? Because it's
telling perl, not HTML::Mason, where to look for perl modules.
If you have a Mason component that loads My::RT::Module, perl's
lib path is searched, not Mason's component root.
Clear? Not clear enough?
(darren)
--
Doubt isn't the opposite of faith; it is an element of faith.
-- Paul Tillich, German theologian.
More information about the rt-users
mailing list