Class::DBI::DataMigration Getting Your Data From There to Here #44

Investigation

Revisit Class::DBI::DataMigration::Mapper::map():

sub map {
    my ($self, $source_object) = @_;
    my %newobj_data = ();
    while ((my $source_key, my $target_key) = each %{$self->target_keys}) {
        my $mapping = $self->mappings->{$source_key}
            or confess "Couldn't retrieve mapping for source key $source_key";
        my $mapped = $mapping->map($source_key, $source_object);
        $newobj_data{$target_key} = $mapped if $target_key;
    }

    return $self->_create_or_edit_object($source_object, \%newobj_data);
}

What's that _create_or_edit_object method doing?

Copyright © 2005 Dan Friedman (Powered by Spork)