From: tla Date: Mon, 3 Jun 2013 07:43:51 +0000 (+0200) Subject: use output database as the userstore for tradition restoration X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1922aeb58c8123a201fcbceb3b817dd13bca2101;p=scpubgit%2Fstemmatology.git use output database as the userstore for tradition restoration --- diff --git a/base/script/make_tradition.pl b/base/script/make_tradition.pl index 1c2cc8e..cea10f9 100755 --- a/base/script/make_tradition.pl +++ b/base/script/make_tradition.pl @@ -97,10 +97,22 @@ if( $informat eq 'db' ) { $args{'sep_char'} = $sep; } } + # If we are writing to the database, use that DB as the userstore. + if( $outformat eq 'db' ) { + unless( $dir ) { + my $extra_args = { 'create' => 1 }; + $extra_args->{'user'} = $dbuser if $dbuser; + $extra_args->{'password'} = $dbpass if $dbpass; + $dir = Text::Tradition::Directory->new( 'dsn' => $dsn, + 'extra_args' => $extra_args ); + } + $args{'userstore'} = $dir; + } ### Custom hacking for Stone if( $informat eq 'CollateText' ) { $args{'sigla'} = [ qw/ S M X V Z Bb B K W L / ]; } + my $scope = $dir->new_scope() if $dir; $tradition = Text::Tradition->new( %args ); } if( $stemmafile ) {