- or download this
#!/usr/bin/env perl
use 5.010;
...
package main;
say ref($_) . '->char() = ' . $_->char for new Father, new Son;
- or download this
Father->char() = father
Son->char() = son
- or download this
has 'char' => (
is => 'ro',
builder => '_build_char', # May override _build_char in subclasse
+s
init_arg => undef, # Disallow setting via constructor
);
sub _build_char { lc ref shift }
- or download this
use MooseX::Declare;
class Father {
...
}
class Son extends Father { }