From 3426caa6d6b8979d681aa33a27d74f3ecc9a96af Mon Sep 17 00:00:00 2001 From: toins Date: Mon, 25 Jun 2007 09:37:26 +0000 Subject: [PATCH] don't escape '-' in regexp. --- misc/bulkupdate.pl | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/misc/bulkupdate.pl b/misc/bulkupdate.pl index 2e0e39f0c5..958f7998dd 100644 --- a/misc/bulkupdate.pl +++ b/misc/bulkupdate.pl @@ -30,11 +30,11 @@ use MARC::File::XML; use MARC::Record; use Getopt::Long; -my ( $process_marcxml, $process_isbn, $help) = (0,0,0); +my ( $no_marcxml, $no_isbn, $help) = (0,0,0); GetOptions( - 'noisbn' => \$process_isbn, - 'noxml' => \$process_marcxml, + 'noisbn' => \$no_isbn, + 'noxml' => \$no_marcxml, 'h' => \$help, 'help' => \$help, ); @@ -55,7 +55,7 @@ if($help){ } my $cpt_isbn = 0; -if(not $process_isbn){ +if(not $no_isbn){ my $query_isbn = " SELECT biblioitemnumber,isbn FROM biblioitems WHERE isbn IS NOT NULL @@ -75,7 +75,7 @@ if(not $process_isbn){ # suppression des tirets de l'isbn my $isbn = $data->[1]; if($isbn){ - $isbn =~ s/\-//g; + $isbn =~ s/-//g; #update my $sth = $dbh->prepare($update_isbn); @@ -86,7 +86,7 @@ if(not $process_isbn){ print "$cpt_isbn updated"; } -if(not $process_marcxml){ +if(not $no_marcxml){ my $query_marcxml = " SELECT biblioitemnumber,marcxml FROM biblioitems WHERE isbn IS NOT NULL @@ -109,17 +109,17 @@ if(not $process_marcxml){ my $marcxml = $data->[1]; eval{ - my $record = MARC::Record->new_from_xml($marcxml,'UTF-8'); + my $record = MARC::Record->new_from_xml($marcxml); my @field = $record->field('010'); foreach my $field (@field){ - my $subfield = $field->subfield('a'); - if($subfield){ - my $isbn = $subfield; - $isbn =~ s/\-//g; - $field->update('a' => $isbn); - } + my $subfield = $field->subfield('a'); + if($subfield){ + my $isbn = $subfield; + $isbn =~ s/-//g; + $field->update('a' => $isbn); + } } - $marcxml = $record->as_xml('UTF-8'); + $marcxml = $record->as_xml; # Update my $sth = $dbh->prepare($update_marcxml); $sth->execute($marcxml,$biblioitemnumber); -- 2.39.5