Help for this page

Select Code to Download


  1. or download this
    my $obj = 'Parent'->new;
    $obj->populate(@data);
    ...
        }
    }
    # Don't forget to handle the case that $obj hasn't changed.
    
  2. or download this
    sub new_from_parent { die "Should be overriden.\n" }
    
    ...
        my @possible_child_classes = @_;
        for my $child_class (@possible_child_classes) {
            # etc. using $self instead of $obj.
    
  3. or download this
    my $obj = 'Parent'->new;
    $obj->populate(@data);
    $obj->rebless(@possible_child_classes);