Cannot use undefined value as ARRAY reference in ~ / modules / Log / Syslog / Constants.pm line 28

It is not possible to use the undefined value as an ARRAY reference in ~ / modules / Log / Syslog / Constants.pm, line 28. (F) The value used as a hard link or a symbolic link must be a specific value. This helps to make some insidious mistakes. The full code is as follows:

package Log::Syslog::Fast::Constants;

use strict;

use warnings;

use Log::Syslog::Constants ();
use Carp 'croak';

require Exporter;
our @ISA = qw(Exporter);


use constant LOG_UDP    => 0; # UDP
use constant LOG_TCP    => 1; # TCP
use constant LOG_UNIX   => 2; # UNIX socket


use constant LOG_RFC3164 => 0;
use constant LOG_RFC5424 => 1;

our @EXPORT = ();
our %EXPORT_TAGS = (
    protos =>  [qw/ LOG_TCP LOG_UDP LOG_UNIX /],
    formats => [qw/ LOG_RFC3164 LOG_RFC5424 /],
);
$EXPORT_TAGS{$_} = $Log::Syslog::Constants::EXPORT_TAGS{$_}
    for qw(facilities severities);
our @EXPORT_OK = @{ $EXPORT_TAGS{all} } = map {@$_} values %EXPORT_TAGS;

sub AUTOLOAD {
    (my $meth = our $AUTOLOAD) =~ s/.*:://;
    if (Log::Syslog::Constants->can($meth)) {
        return Log::Syslog::Constants->$meth(@_);
    }
    croak "Undefined subroutine $AUTOLOAD";
}

1;
+4
source share
1 answer

The problem is caused by using a module Log::Syslog::Constantsthat is incompatible with your module Log::Syslog::Constants::Fast.

::Fast Log::Syslog::Constants, ( qw(facilities severities)) %EXPORT_OK Log::Syslog::Constants, , ::Fast undef 27.

, :

1: , Log::Syslog::Constants.

, use Data::Dumper; print Dumper(\%INC); ::Fast, , Constants.pm, , , Log::Syslog .

, , ::Fast (, use lib), - , Log::Syslog::Constants - , "" .

2:. Log::Syslog::Constants, , Log::Syslog::Constants::Fast.

, Log::Syslog::Constants, , %EXPORT_OK.

, , , ( ) . , ::Fast; . ::Fast, <::Fast.

0

Source: https://habr.com/ru/post/1650754/


All Articles