Help for this page

Select Code to Download


  1. or download this
    my $obj = {};  # empty anonymous hash reference
    bless $obj, "Some::Class";
    
  2. or download this
    package Some::Class;
    
    my $obj = {};
    bless $obj;    # blesses into "Some::Class"
    
  3. or download this
    $obj->method( 'foo' );        # @_ contains ( $obj, 'foo' )
    Some::Class->method( 'foo' ); # @_ contains ( 'Some::Class', 'foo' )
    
  4. or download this
    package Some::Class;
    
    ...
      bless $self, $class:   # bless it into the class
      return $self;
    }