Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scalar found where operator expected at <script>

Tags:

perl

moose

use Moose;

extends 'TEST::Role';

has 'name' => (
    is => 'ro',
    isa => 'Str',
    default => 'me',
);

This works in perl 5.8.5 but not in 5.8.8.

How to resolve it?

String found where operator expected at B.PM line 4, near "extends 'TEST::Role'"
        (Do you need to predeclare extends?)
like image 593
joe Avatar asked Jun 26 '26 14:06

joe


2 Answers

If you can get this into a failing test and post it to either the Moose mailing list, or #moose on irc.perl.org I'm sure someone can help sort out what is going on.

Please be sure to include all of the code, your package declaration is missing here (and as a first hint, I wouldn't name my package B because that collides with a core package).

like image 188
perigrin Avatar answered Jun 29 '26 06:06

perigrin


That will happen if there is no function named extends. Perhaps you have a broken or old Moose install? Perhaps the line before use Moose; is missing a semi-colon?

By the way, your file name should be .pm, not .PM.

like image 41
ikegami Avatar answered Jun 29 '26 07:06

ikegami



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!