I have this perl script that I found on the list but I have an error when I run it: (my apologies if this a perl error, should find a perl list and post it there)
At Wednesday 6/27/2007 11:08 AM, Carlos Ramon Lopez Midence wrote:
I have this perl script that I found on the list but I have an error
when I run it: (my apologies if this a perl error, should find a
perl list and post it there)
use DBI;
use RT::Interface::CLI qw (CleanEnv GetCurrentUser);
Load the RT configuration
RT::LoadConfig();
Initialiaze RT
RT::Init();
#-------------------------------Gets current user name:
my $user = RT::User->new($RT::SystemUser);
print $user;
#-------------------------------Gets queue names
my $queue_id = 10;
my $queue_obj = RT::Queue->new( $session{‘CurrentUser’} );
Carlos,
This is a Perl error - you’re referring to a variable called
%session, but you haven’t declared it. I’m guessing you got
this piece of code from the web app, which makes %session available
to you, and already has the current user object stored in it.
What you can do is this:
my $current_user = GetCurrentUser();
and then use $current user instead of $session{‘CurrentUser’}
OR - you could use RT::SystemUser instead of $session{‘CurrentUser’}
I don’t really sure if you need to use RT::Interface::CLI, you could have tried to eliminate it.
A problem with %session might be caused by your use of $session{ ‘CurrentUser’ }, try $RT::SystemUser instead.
I have this perl script that I found on the list but I have an error when I run it: (my apologies if this a perl error, should find a perl list and post it there)