- or download this
package Foo;
...
has 'name' => (is => 'rw');
1;
- or download this
package Abc;
...
sub table_name { 'ABC_TABLE' }
1;
- or download this
package NoTableName;
...
with 'Foo';
1;
- or download this
use strict;
use warnings;
...
my $obj = Abc->new(name => 'Steve');
printf "My name is %s\n", $obj->name;
- or download this
C:\Users\arun>perl abc.t
My name is Steve
- or download this
use strict;
use warnings;
...
my $obj = NoTableName->new(name => 'Bob');
printf "My name is %s\n", $obj->name;
- or download this
C:\Users\arun>perl -c notablename.t
'Foo' requires the method 'table_name' to be implemented by 'NoTableNa
+me' at C:/Perl/site/lib/Moose/Meta/Role/Application.pm line 59
...
eval {...} called at NoTableName.pm line 0
Compilation failed in require at notablename.t line 3.
BEGIN failed--compilation aborted at notablename.t line 3.