Help for this page

Select Code to Download


  1. or download this
    package My;
    
    ...
    my $mya = My::A->new({name => 'Dave'});
    $mya->greet();
    
  2. or download this
    my %subs = (
        new   => sub { # constructor goes here... },
    ...
        no strict 'refs';
        *{$pkg_sub . '::' . $name} = $code;
    }
    
  3. or download this
    {
        # ...
    ...
          *{"$class"."::"."$name"} = $code;
        }
      }