Help for this page

Select Code to Download


  1. or download this
    package MyClass;
    sub new {
    ...
      $_[0]{attribute2}= $_[1] if @_ > 1;
      $_[0]{attribute2}
    }
    
  2. or download this
    package MyClass;
    use Moo;
    has attribute1 => ( is => 'ro' );
    has attribute2 => ( is => 'rw' );