Im very new to perl programming. I'm using the otrs perl modules, with php. I'm able to pass the control from php script to perl modules. But the problem is that im not able to pass variables to the other modules in the internal link. How could I do that? Please help me.
I'm using This code.
Code: Select all
<?php
$perl = new Perl();
$perl->eval("BEGIN {unshift( @INC, '/opt/otrs');}");
$perl->eval('use Kernel::System::Auth qw(GetOption new);
use Kernel::Config qw(Load);
use Kernel::System::Encode qw(new);
use Kernel::System::Log qw(new);
use Kernel::System::Main qw(new);
use Kernel::System::DB qw(new);
use Kernel::System::Time qw(new);
use Kernel::System::User qw(new DBObject ConfigObject LogObject TimeObject MainObject EncodeObject);
use Kernel::System::Group qw(new);
use Kernel::System::Auth qw(new);
my $ConfigObject = Kernel::Config->new();
my $EncodeObject = Kernel::System::Encode->new(
ConfigObject => $ConfigObject,
);
my $LogObject = Kernel::System::Log->new(
ConfigObject => $ConfigObject,
EncodeObject => $EncodeObject,
);
my $MainObject = Kernel::System::Main->new(
ConfigObject => $ConfigObject,
EncodeObject => $EncodeObject,
LogObject => $LogObject,
);
my $DBObject = Kernel::System::DB->new(
ConfigObject => $ConfigObject,
EncodeObject => $EncodeObject,
LogObject => $LogObject,
MainObject => $MainObject,
);
my $TimeObject = Kernel::System::Time->new(
ConfigObject => $ConfigObject,
LogObject => $LogObject,
);
my $UserObject = Kernel::System::User->new(
ConfigObject => $ConfigObject,
LogObject => $LogObject,
MainObject => $MainObject,
TimeObject => $TimeObject,
DBObject => $DBObject,
EncodeObject => $EncodeObject,
);
my $GroupObject = Kernel::System::Group->new(
ConfigObject => $ConfigObject,
LogObject => $LogObject,
DBObject => $DBObject,
);
my $AuthObject = Kernel::System::Auth->new(
ConfigObject => $ConfigObject,
EncodeObject => $EncodeObject,
LogObject => $LogObject,
UserObject => $UserObject,
GroupObject => $GroupObject,
DBObject => $DBObject,
MainObject => $MainObject,
TimeObject => $TimeObject,
);
');
$ar=array(From => 'me@example.com',
To => 'friend@example.com',
Subject => 'Some words!',
Charset => 'iso-8859-15',
MimeType => 'text/plain',
Body => 'Some nice text',
InReplyTo => '<somemessageid-2@example.com>',
References => '<somemessageid-1@example.com> <somemessageid-2@example.com>',
Loop => 1,
Attachment => '',
Sign => '',
Crypt => '',
Priority => 'error',
Message => "Need $_!" );
$p=new Perl();
$p->new();
var_dump($p->{$AuthBackend}->GetOption($ar));
?>
But im getting the following error.
Fatal error: Uncaught exception 'PerlException' with message '[perl] eval error: (in cleanup) Got no DBObject! at /opt/otrs/Kernel/System/User.pm line 99. ' in /var/www/mohan/t9.php:62 Stack trace: #0 /var/www/mohan/t9.php(62): Perl->eval('use Kernel::Sys...') #1 {main} thrown in /var/www/mohan/t9.php on line 62