[Rt-devel] RT.pm LoadConfig sub ... is this a logic error?

Drew Barnes barnesaw at ucrwcu.rwc.uc.edu
Thu Apr 21 16:06:41 EDT 2005


I had all kinds of wierd errors/messages until I touched the logfile.  
Have you done that?

What that code does, I think, is load the SiteConfig to get the values 
set there, then the Config file to get the rest.  I usually only 
populate SiteConfig with the values I want to change from the defaults.

Lidio Presutti wrote:

>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;
>}
>
>_______________________________________________
>Rt-devel mailing list
>Rt-devel at lists.bestpractical.com
>http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel
>  
>

-- 
Drew Barnes
Applications Analyst
Raymond Walters College
University of Cincinnati



More information about the Rt-devel mailing list