Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/env perl
    
    use 5.010;
    ...
    
    package main;
    say ref($_) . '->char() = ' . $_->char for new Father, new Son;
    
  2. or download this
    Father->char() = father
    Son->char() = son
    
  3. 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 }
    
  4. or download this
    use MooseX::Declare;
    
    class Father {
    ...
    }   
    
    class Son extends Father { }