[Rt-devel] RT.pm LoadConfig sub ... is this a logic error?
Lidio Presutti
lidio at ic-unix.ic.utoronto.ca
Thu Apr 21 15:33:22 EDT 2005
Hi folks,
kind of new with RT. I copied RT_Config.pm to RT_SiteConfig.pm and then I
had made a change to my RT_SiteConfig.pm. I changed
Set($LogToSyslog , 'debug');
Set($LogToFile , undef);
to
Set($LogToSyslog , undef);
Set($LogToFile , 'debug');
[Don't ask why ;-) ]
When I did not see the effect of the change I did a trace of the code
dealing with it.
I believe there maybe a "logic" error in the "LoadConfig" sub [see code
snippet below]. As the comments say, first load the "core config" and
then the site. But the actual code loads the site first and then the
core. To me that would reset values to the "core" default (due to the
"undef" value in the "Set".
I would have done it differently [unless I am misunderstanding something]
-- remove the "unless defined $_[0]" clause in the "Set" sub, and move the
"if (...)" clause after the "require $CORE_CONFIG_FILE ..." statement.
For your amusement,
Lidio Presutti
Manager of Help Desk and LAN & Workstation Technology Services
Information Commons Phone: (416) 978-5130
University of Toronto Fax: (416) 978-0440
------------------------------
in RT.pm
...
=head2 LoadConfig
Load RT's config file. First, go after the core config file.
After that, go after the site config.
=cut
sub LoadConfig {
local *Set = sub { $_[0] = $_[1] unless defined $_[0] };
if ( -f "$SITE_CONFIG_FILE" ) {
require $SITE_CONFIG_FILE
|| die ("Couldn't load RT config file '$SITE_CONFIG_FILE'\n$@");
}
require $CORE_CONFIG_FILE
|| die ("Couldn't load RT config file '$CORE_CONFIG_FILE'\n$@");
RT::I18N->Init;
}
More information about the Rt-devel
mailing list