Subject: | Syntax error weirdness |
The example code attached shows that two very simple classes which "use" each other will
cause a syntax error when running perl -wc or Test::Strict:
Eduardo-Arino-De-La-Rubias-MacBook-Pro:tmp earino$ perl -wc Foo.pm
String found where operator expected at Foo.pm line 7, near "has 'thingy'"
(Do you need to predeclare has?)
syntax error at Foo.pm line 7, near "has 'thingy'"
BEGIN not safe after errors--compilation aborted at Foo.pm line 11.
Eduardo-Arino-De-La-Rubias-MacBook-Pro:tmp earino$ perl ./use_clashes_with_has.t
1..1
not ok 1 - Syntax check ./Foo.pm
# Failed test 'Syntax check ./Foo.pm'
# at ./use_clashes_with_has.t line 8.
# String found where operator expected at ./Foo.pm line 7, near "has 'thingy'"
# (Do you need to predeclare has?)
# syntax error at ./Foo.pm line 7, near "has 'thingy'"
# BEGIN not safe after errors--compilation aborted at ./Foo.pm line 11.
# Looks like you failed 1 test of 1.
My environment:
This is perl, v5.10.0 built for darwin-thread-multi-2level
Darwin earino-laptop-wired.lightningsource.com 10.6.0 Darwin Kernel Version 10.6.0: Wed
Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386 i386
Subject: | use_clashes_with_has.t |
#!/usr/bin/env perl
use warnings;
use strict;
use Test::Strict tests => 1;
syntax_ok("./Foo.pm");
Subject: | OtherModule.pm |
use MooseX::Declare;
class OtherModule {
use Foo;
has 'baz' => (
'is' => 'ro',
'isa' => 'Int',
'default' => 7,
);
}
Subject: | Foo.pm |
use MooseX::Declare;
class Foo {
use Carp;
use OtherModule;
has 'thingy' => (
'is' => 'ro',
'isa' => 'Bool',
);
}