Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
    throws_ok {My::Base->new()} qr/Attribute \(attr\) is required/, q/inhe
    +rited requires 'attr' at construction/;
    my $inh = new_ok('My::Inherited' => [attr => 'constructor value']);
    cmp_ok($inh->attr, 'eq', "The value of attr is 'constructor value'", '
    +inherited is correct');
    
  2. or download this
    1..9
    ok 1 - base requires 'attr' at construction
    ...
    ok 8 - The object isa My::Inherited
    ok 9 - inherited is correct
    # Looks like you failed 1 test of 9.