File: gedcom_compare

package info (click to toggle)
libgedcom-perl 1.22-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 828 kB
  • sloc: perl: 7,883; sh: 102; makefile: 10
file content (54 lines) | stat: -rwxr-xr-x 1,120 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/local/bin/perl -w

# Copyright 2003-2019, Paul Johnson (paul@pjcj.net)

# This software is free.  It is licensed under the same terms as Perl itself.

# The latest version of this software should be available from my homepage:
# http://www.pjcj.net

# Version 1.22 - 15th November 2019

use strict;

require 5.005;

use Data::Dumper;
$Data::Dumper::Indent = 1;

use Gedcom 1.22;

use vars qw( $VERSION );
$VERSION = "1.22";

$SIG{__WARN__} = sub { print STDERR "\n@_" };

sub main {
    my ($g1, $g2) = @ARGV;

    $| = 1;

    print "reading $g1 ...";
    my $ged1 = Gedcom->new(
        gedcom_file => $g1,
        callback    => sub { print "." },
        read_only   => 0,
    );

    print "\nreading $g2 ...";
    my $ged2 = Gedcom->new(
        gedcom_file => $g2,
        callback    => sub { print "." },
        read_only   => 0,
    );
    print "\n";

    # my $comparison = $ged1->{record}->compare($ged2->{record});
    my $comparison = $ged1->get_individual("I1")
                          ->compare($ged2->get_individual("I0003"));

    $comparison->print;
    # print Dumper $comparison;
}

main