开发者

My Perl module is found but not being applied

I have created my own Perl module. I reference it from file Config.pm.

When I take the content from my Perl module and copy it into Config.pm, the script is triggered appropriately. But when I include it like this:

use severalnines;
Kernel::severalnines::config_severalnines($Self);

it is not triggered. I am sure that the file is found because when I try to change the name of the file, I get errors (Premature end of script headers: ).

This is the file (severalnines.pm) I want to include in Config.pm:

package Kernel::severalnines开发者_高级运维;

sub config_severalnines      
{                       
     $Self->{TicketAcl}->{'ACL-Name-Typer'} = {
        Properties => {Frontend => {Action => ['CustomerTicketMessage']},
             # current ticket match properties
             CustomerUser => {
                     Group_rw => [ 'Incident Management Severalnines', ],
             },
     },
     Possible => {
             Ticket => {
             Type => ['Incident',],},
     },
   };
}
1;

The severalnines.pm is located in /usr/lib/perl5/5.12.3 which is listed when doing perl -V.

What could the problem be?

Thank you in advance!


Your subroutine isn't doing anything with the parameter it is passed; instead it is setting a package variable $Kernel::severalnines::Self.

Add:

my ($Self) = @_;

at the top of your subroutine code.

Also, add:

use strict;
use warnings;

to the top of your module file (or perhaps after package ...;). This would have alerted you that you were using an undeclared variable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜