Help for this page

Select Code to Download


  1. or download this
    package Foo;
    
    ...
    has 'name' => (is => 'rw');
    
    1;
    
  2. or download this
    package Abc;
    
    ...
    sub table_name { 'ABC_TABLE' }
    
    1;
    
  3. or download this
    package NoTableName;
    
    ...
    with 'Foo';
    
    1;
    
  4. or download this
    use strict;
    use warnings;
    ...
    
    my $obj = Abc->new(name => 'Steve');
    printf "My name is %s\n", $obj->name;
    
  5. or download this
    C:\Users\arun>perl abc.t
    My name is Steve
    
  6. or download this
    use strict;
    use warnings;
    ...
    
    my $obj = NoTableName->new(name => 'Bob');
    printf "My name is %s\n", $obj->name;
    
  7. 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.