Overlaying lib/RT/Interface/Web.pm

Good day

Is the anybody knows can I overlaying lib/RT/Interface/Web.pm?
I am tryed, but got error like Global symbol "%session" requires explicit package name etc.

In your overlay try setting the package to package HTML::Mason::Commands;

thanks, all worked well.
but I wanted also to overlaying Interface/Email.pm like that - it didn’t work. :frowning:

What wrong with that overlay? It should be the normal package name

package RT::Interface::Email;

use strict;
use warnings;
use 5.010;

sub Gateway {
[just copy subroutine]
}

and got the error:

[15868] [Thu Aug 22 15:11:04 2019] [critical]: Global symbol “$SCOPE” requires explicit package name at /opt/rt4/sbin/…/local/lib/RT/Interface/Email_Overlay.pm line 20.
BEGIN not safe after errors–compilation aborted at /opt/rt4/sbin/…/local/lib/RT/Interface/Email_Overlay.pm line 96.

I am not sure how this will effect Email.pm but you can try adding this to the top of the overlay file

my $SCOPE;
sub TMPFAIL { unwind (-75,     $_[0], undef, => $SCOPE) }
sub FAILURE { unwind (  0,     $_[0], $_[1], => $SCOPE) }
sub SUCCESS { unwind (  1, "Success", $_[0], => $SCOPE) }

I did it. got the error:

Bareword “HERE” not allowed while “strict subs” in use at /opt/rt4/sbin/…/local/lib/RT/Interface/Email_Overlay.pm line 25.

added

use Scope::Upper qw/unwind HERE/;

and all ok. thanks

And last (I hope) question: how overlaying lib/RT/Config.pm?
I tryed next:

package RT::Config;

use strict;
use warnings;

use 5.010;
use File::Spec ();
use Symbol::Global::Name;
use List::MoreUtils ‘uniq’;

our @PreInitLoggerMessages;

our %META;
%META = (
Key1 => {
Section => ‘Ticket display’,
Overridable => 1,
SortOrder => 12,
Widget => ‘/Widgets/Form/Boolean’,
WidgetArguments => {
Description => ‘descr’,
},
}
);

1;

but no luck. no errors, but most user settings disappear (but not all).

What’re you trying to do?

I’m trying to overlay config.pm.
I have a one additional item in user preferences and I want place it in config_Overlay.pm.

Based on your snippet posted it looks like you deleted the existing has and replaced it with a new one right? That would explain why all the user preferences are missing since the only thing in the %META hash is now the key you added

You misunderstood me. Firstly, I am adding a new key, and not replacing an existing one. secondly - not all settings are missing, but almost all. 5-7 settings remain that are not associated with the new key. and my setting is also added.

besides I use our %META

By saying that you are setting the whole hash I believe, are you setting a custom key or an existing RT key?

I am setting custom key

Do you have some custom code then looking for this key? I believe you could look at setting it as a config option in RT_SiteConfig.pm if that is the case

If I hardcode my key in config.pm - all works fine.
But I don’t want hardcode, I want try use overlay.

In RT_SiteConfig.pm I have this key for global setting