Koha/misc/exportauth.pl
Galen Charlton b8a58c4934 installer: command-line scripts improve finding C4 modules
Command-line scripts now use a new SCRIPT_DIR/kohalib.pl
to put installed location of Koha's Perl modules
into @INC.
2007-12-17 09:13:54 -06:00

37 lines
950 B
Perl
Executable file

#!/usr/bin/perl
## This script allows you to export a rel_2_2 bibliographic db in
#MARC21 format from the command line.
#
use strict;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin;
eval { require "$FindBin::Bin/kohalib.pl" };
}
require Exporter;
use C4::Auth;
use C4::Output; # contains gettemplate
use C4::Biblio;
use CGI;
use C4::Auth;
my $outfile = $ARGV[0];
open(OUT,">$outfile") or die $!;
my $query = new CGI;
my $dbh=DBI->connect("DBI:mysql:database=koha2;host=localhost;port=3306","kohaserver","kohaserver") or die $DBI::errmsg;
#$dbh->do("set character_set_client='latin5'");
#$dbh->do("set character_set_connection='utf8'");
#$dbh->do("set character_set_results='latin5'");
#my $dbh=C4::Context->dbh;
my $sth;
$sth=$dbh->prepare("select marc from auth_header order by authid");
$sth->execute();
while (my ($marc) = $sth->fetchrow) {
print OUT $marc;
}
close(OUT);