[Rt-devel] [patch] RT::Interface::Web _Overlay/_Vendor/_Local not being included
Jesse Vincent
jesse at bestpractical.com
Tue Apr 26 11:04:52 EDT 2011
On Mon 25.Apr'11 at 17:05:22 -0700, Ivan Kohler wrote:
> On Thu, Apr 21, 2011 at 06:18:40AM +0400, Ruslan Zakirov wrote:
> > Hello,
> >
> > This is still doesn't return old behaviour. Which was with side effects.
> >
> > Old code was loading .../Web_Local.pm, but code was compiled in
> > HTML::Mason::Commands space unless explicit package is defined in
> > _Local.pm file.
>
>
> Okay, how about this instead of the previous patch:
>
I believe killing string eval was an explicit goal of the rewrite.
-j
> --- lib/RT/Base.pm 18 Apr 2011 23:04:59 -0000 1.1.1.11
> +++ lib/RT/Base.pm 25 Apr 2011 23:59:49 -0000
> @@ -166,11 +166,11 @@
>
> sub _ImportOverlays {
> my $class = shift;
> - my ($package,undef,undef) = caller();
> - $package =~ s|::|/|g;
> + my ($package, $package_filename, undef) = caller();
> + $package_filename =~ s/\.pm$//;
> for (qw(Overlay Vendor Local)) {
> - my $filename = $package."_".$_.".pm";
> - eval { require $filename };
> + my $filename = $package_filename."_".$_.".pm";
> + eval " package $package; require '$filename'; ";
> die $@ if ($@ && $@ !~ qr{^Can't locate $filename});
> }
> }
>
>
> This uses the calling filename to determine the overlay names, then
> compiles the result in the caller's current package.
>
> Let me know if this works for you.
>
> --
> Ivan Kohler, President and Head Geek, Freeside Internet Services, Inc.
> Open-source billing, ticketing and provisioning - http://www.freeside.biz/
>
>
> > On Wed, Apr 20, 2011 at 9:44 PM, Ivan Kohler <ivan-rt-devel at 420.am> wrote:
> > > RT::Interface::Web_Overlay, Web_Vendor and Web_Local are not being
> > > called.
> > >
> > > This is a regression from RT 3.8.9->3.8.10 and also affects 4.0.0rc8
> > >
> > > RT::Interface::Web is in package HTML::Mason::Commands when it calls
> > > RT::Base->_ImportOverlays, so it looks for the wrong files.
> > >
> > > I figured reworking _ImportOverlays to use the calling filename instead
> > > of calling package is not desirable (but I'd be happy to give that a
> > > shot if you prefer), so this patch fixes things:
> > >
> > >
> > > diff -u lib/RT/Interface/Web.pm.DIST lib/RT/Interface/Web.pm
> > > --- lib/RT/Interface/Web.pm.DIST 2011-04-20 10:33:53.000000000 -0700
> > > +++ lib/RT/Interface/Web.pm 2011-04-20 10:34:04.000000000 -0700
> > > @@ -2756,6 +2756,7 @@
> > > return $scrubber;
> > > }
> > >
> > > +package RT::Interface::Web;
> > > RT::Base->_ImportOverlays();
> > >
> > > 1;
> >
> >
> >
> > --
> > Best regards, Ruslan.
>
> _______________________________________________
> List info: http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel
More information about the rt-devel
mailing list