#!/usr/bin/perl -- use strict; use warnings; Main( @ARGV ); exit( 0 ); BEGIN { package Point; use Moose; has 'x' => (isa => 'Int', is => 'rw', required => 1); has 'y' => (isa => 'Int', is => 'rw', required => 1); sub clear { my $self = shift; $self->x(0); $self->y(0); } } sub Main { print Point->new->dump; print Point->new({})->dump; print Point->new({})->x; } __END__ Attribute (x) is required at C:\perl\site\lib\Moose\Object.pm line 24 Moose::Object::new('Point') called at - line 18 main::Main at - line 4
In reply to Re: Moose required creates empty object Can't locate object method "x" via package "Point"
by Anonymous Monk
in thread Moose required creates empty object Can't locate object method "x" via package "Point"
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |