[rt-users] Replacing functions

Ruslan Zakirov ruz at bestpractical.com
Wed Feb 6 15:27:08 EST 2008


In the bottom of main .pm file you can find something like:
eval "require RT::EmailParser_Vendor";
die $@ if ($@ && $@ !~ qr{^Can't locate RT/EmailParser_Vendor.pm});
eval "require RT::EmailParser_Local";
die $@ if ($@ && $@ !~ qr{^Can't locate RT/EmailParser_Local.pm});

Such code loads matching _Vendor.pm and _Local.pm files. So you can
use local/lib/RT/EmailParser_Local.pm to override that function.
_Overlay.pm we use only where main .pm file is auto-generated by a
tool, but that doesn't mean you can not use _Local.pm files for those
without overlay.pm.

You can use the following command to test that:
find lib/ -type f -name '*.pm' | xargs grep -lP 'require\s.*_Local'

Please, update the wiki with this info so next time people will get
everything right without asking.

On Feb 6, 2008 9:39 PM, Tuc at T-B-O-H <ml at t-b-o-h.net> wrote:
> Hi,
>
>         I saw that, but the original file isn't in a XXX_Overlay.pm file
> currently. Does that not make it eligible for overlay/local? I'd rather
> not use the local dir and overwrite the entire module, just the
> LookupExternalUserInfo function.
>
>                 Thanks, Tuc
>
>
> >
> > http://wiki.bestpractical.com/view/CleanlyCustomizeRT
> > read about overlays and local dir
> >
> > On Feb 5, 2008 11:13 PM, Tuc at T-B-O-H <ml at t-b-o-h.net> wrote:
> > > Hi,
> > >
> > >         In RT2 we used to override the LookupExternalUserInfo in the
> > > config file. I read about RT3 doing it in a _Local file, but I
> > > see things on Google with people putting in User_Local.pm . Shouldn't
> > > it go in EmailParser_Local.pm? And does it go into my $RT/etc/
> > > directory or the $RT/lib/RT directory?
> > >
> > >         (FreeBSD ports install)
> > >
> > >                 Thanks, Tuc
>
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
>



-- 
Best regards, Ruslan.



More information about the rt-users mailing list