Help for this page

Select Code to Download


  1. or download this
    package Singleton;
    my $singleton;
    ...
      my $class = shift;
      $singleton ||= bless {}, $class;
    }
    
  2. or download this
    package SingletonBase;
    my $singleton;
    ...
      my $class = shift;
      $singleton{ $class } ||= bless {}, $class;
    }
    
  3. or download this
    # encapsulated class data
    {
    ...
      return $self;
      
    }