Help for this page

Select Code to Download


  1. or download this
    sub add_method {
        my $class = shift;
    ...
        no strict 'refs'; # because you should have strict on
        *{$class . '::' . $name} = $code;
    }
    
  2. or download this
    # you must call this as a method, and pass it a CODE ref
    blort->add_method('foo', sub { print 'bar' });
    
    # now you can do this ...
    blort::foo();