Subject: | Incomplete "use strict" error message |
Failing to declare a variable with my or our results in an error since
MooseX::Declare obviously includes "use strict" automatically. When
such an undeclared occurs in a method that is not the last method of
the class, only the following message is given:
BEGIN not safe after errors--compilation aborted at lib/Bug/Little.pm
line 10.
Compilation failed in require.
BEGIN failed--compilation aborted.
It should rather be:
Global symbol "$date" requires explicit package name at lib/Bug/
Little.pm line 6.
BEGIN not safe after errors--compilation aborted at lib/Bug/Little.pm
line 10.
Compilation failed in require.
BEGIN failed--compilation aborted.
Obviously, the first line is missing. The example code below
demonstrates the issue. If you leave out method mlittle3, it won't
occur.
use MooseX::Declare;
class Bug::Little{
method mlittle2(){
$date='test';
return 'mlittle2';
}
method mlittle3(){
return 'mlittle3';
}
}