
chebarbudo
New User
Jul 26, 2017, 7:30 AM
Post #1 of 2
(1523 views)
|
Hi there, 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:
#!/usr/bin/perl use strict; use warnings; use utf8; use Kernel::System::ObjectManager; 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 $? 0 How can I make sure that if the function TicketMerge fails, the whole script fails and we know it? Regards Santiago
|