From: Shawn Boyette Date: Thu, 28 Aug 2008 18:59:49 +0000 (+0000) Subject: oops. forgot how GetOptions() treats the incoming hashref X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=commitdiff_plain;h=7351fcc9ec51d6587fa3f05a041b8ff39ce42e1d oops. forgot how GetOptions() treats the incoming hashref --- diff --git a/renumber_marc b/renumber_marc index 410b620..2b1b23a 100755 --- a/renumber_marc +++ b/renumber_marc @@ -56,17 +56,6 @@ sub initialize { # set mode on existing filehandles binmode(STDIN, ':utf8'); - # set defaults if told to do so - if ($c->{incoming}) { - $c->{tag} = 903; - $c->{subfield} = 'a'; - $c->{output} = 'incoming.renumbered.marc.xml'; - } elsif ($c->{incumbent}) { - $c->{tag} = 901; - $c->{subfield} = 'c'; - $c->{output} = 'incumbent.renumbered.marc.xml'; - } - my $rc = GetOptions( $c, 'incoming', 'incumbent', @@ -79,6 +68,19 @@ sub initialize { show_help() unless $rc; show_help() if ($c->{help}); + # set defaults if told to do so + if ($c->{incoming}) { + $c->{tag} = 903 unless defined $c->{tag}; + $c->{subfield} = 'a' unless defined $c->{subfield}; + $c->{output} = 'incoming.renumbered.marc.xml' + unless defined $c->{output}; + } elsif ($c->{incumbent}) { + $c->{tag} = 901 unless defined $c->{tag}; + $c->{subfield} = 'c' unless defined $c->{subfield}; + $c->{output} = 'incumbent.renumbered.marc.xml' + unless defined $c->{output}; + } + my @keys = keys %{$c}; show_help() unless (@ARGV and @keys); for my $key ('renumber-from', 'tag', 'subfield', 'output')