[Rt-devel] Problems using RT.pm under a web environment

Simon Wistow simon at thegestalt.org
Fri Jul 29 07:15:29 EDT 2005


For a variety of reasons I want users to be able to create Queues via a 
web interface.

I have a bit of code which looks like

    BEGIN {
      use lib( "/opt/rt3/local/lib", "/opt/rt3/lib");
      eval {
		use RT;
        RT::LoadConfig();
      };
      die $@ if $@;
    }
    RT::Init();


    my $queue   = RT::Queue->new($RT::SystemUser);
    my ($status,$msg) = $queue->Create(%conf);


which works fine from the command line but fails dismally from within a 
CGI with the error

[Fri Jul 29 12:04:14 2005] [error] [client 172.16.11.34] Couldn't 
require MPC::SoftwareCatalogue::Rt : Can't locate 
/opt/rt3/etc/RT_SiteConfig.pm in @INC (@INC contains: /opt/rt3/local/lib 
/opt/rt3/lib 
[ ... ]
 .) at /opt/rt3/lib/RT.pm line 124., referer: 
http://software/portfolio/rt
[Fri Jul 29 12:04:14 2005] [error] [client 172.16.11.34] BEGIN 
failed--compilation aborted at 
/home/software_portfolio/lib//MPC/SoftwareCatalogue/Rt.pm line 14., 
referer: http://software/portfolio/rt
[Fri Jul 29 12:04:14 2005] [error] [client 172.16.11.34] Compilation 
failed in require at /var/www/html/portfolio/index.cgi line 29., 
referer: http://software/portfolio/rt
[Fri Jul 29 12:04:14 2005] [error] [client 172.16.11.34] , referer: 
http://software/portfolio/rt


I've tried fiddling round with the require in /opt/rt3/lib/RT.pm 
thinking that maybe it needed the 

	eval "require $class";

form of require.

I suppose I could add /opt/rt3/etc into my @INC and write my own version 
of RT::LoadConfig() which just does a 

   require RT_SiteConfig;

which may fix it but I want to know if I'm doing anything especially 
dumb before I do that.

Cheers

Simon



-- 
rorshach and prozac and everything's groovy



More information about the Rt-devel mailing list