Rafael Manoel
Rafael Manoel

Reputation: 123

My Perl warnings are FATAL and I don't know why

I have two servers with the same configurations: httpd + mod_perl (I thought the settings were 100% the same), but in one server I got some perl warnings, while in the other server the same warnings get me FATAL errors. Look:

Server A log: Use of uninitialized value in numeric eq (==) at

Server B log: [Wed Jun 08 14:32:47 2016] [error] Use of uninitialized value in string eq at

In server A the request flow goes on and the user gets the desired result, but in server B the user gets a 500 error.

I am using

use strict;
use warnings;

in the file on both servers.

Any thoughts ?

Example of the code causing this warning/FATAL:

$allowed_sellers = any { $_ == $user->{user_id} } (111,123,222,345);

UPDATE:

I found this code in a module that I am using (Moo):

package Moo::_strictures;
use strict;
use warnings;

sub import {
  if ($ENV{MOO_FATAL_WARNINGS}) {
    require strictures;
    strictures->VERSION(2);
    @_ = ('strictures');
    goto &strictures::import;
  }
  else {
    strict->import;
    warnings->import;
  }
}

1;

But the env variable MOO_FATAL_WARNINGS seems to not be defined. Any thougts ?

SOLVED:

Guys, thanks a lot! We have finally discovered the problem: In server A the version of module Moo was 1.003 while server B was using a newer version 2.000001

Upvotes: 4

Views: 187

Answers (1)

ThisSuitIsBlackNot
ThisSuitIsBlackNot

Reputation: 24083

Before version 2, calling use Moo; enabled strictures, which makes all warnings fatal except for a few categories. This caused a lot of problems*, so warnings are no longer fatal in version 2 and up.

To fix, upgrade Moo to the latest version. While you're at it, you should really fix the cause of the warnings, too.


* See the following discussions:

Upvotes: 4

Related Questions