Jul 26, 2017, 7:30 AM
Post #1 of 2
Today I wrote my first Perl script. Not that I want to go deep into it. But we just moved to OTRS and Perl is the way to play with it. So I wrote the following scritp:
local $Kernel::OM = Kernel::System::ObjectManager->new();
my $TicketObject = $Kernel::OM->Get('Kernel::System::Ticket');
my $Success = $TicketObject->TicketMerge(
MainTicketID => 1673,
MergeTicketID => 1689123,
UserID => 1,
) || die();
In this specific scenario, ticket #1689123 does not exist and the function TicketMerge fails outputing many error messages. So I'm expecting the whole script to exit with error but it does not:
$ perl myscript; echo $?
How can I make sure that if the function TicketMerge fails, the whole script fails and we know it?