use new stemma util interface; configure correct IDP server. Fixes #31
tla [Wed, 15 Jan 2014 18:47:04 +0000 (19:47 +0100)]
Makefile.PL
lib/stemmaweb/Controller/Root.pm
lib/stemmaweb/Controller/Stexaminer.pm
stemmaweb.conf

index a87978f..6dd80af 100644 (file)
@@ -12,7 +12,7 @@ all_from 'lib/stemmaweb.pm';
 # Tradition libraries
 requires 'Text::Tradition' => '1.2';
 requires 'Text::Tradition::Directory';
-requires 'Text::Tradition::Analysis';
+requires 'Text::Tradition::Analysis' => '1.3';
 requires 'Text::Tradition::StemmaUtil';
 # Catalyst libraries
 requires 'Catalyst::Runtime' => '5.90002';
index eebf21a..a3cc076 100644 (file)
@@ -396,21 +396,6 @@ sub stemma :Local :Args(2) {
        if( $c->req->method eq 'POST' ) {
                if( $ok eq 'full' ) {
                        my $dot = $c->request->body_params->{'dot'};
-                       # Graph::Reader::Dot does not handle bare unicode. We get around this
-                       # by wrapping all words in double quotes, as long as they aren't already
-                       # wrapped, and as long as they aren't the initial '(di)?graph .*'.
-                       # Horrible HACK.
-                       my @dlines = split( "\n", $dot );
-                       my $wdot = '';
-                       foreach( @dlines ) {
-                               unless( /^(di)?graph/ ) { # Skip the first line
-                                       s/(?<!")\b(\w+)\b(?!")/"$1"/g;
-                               }
-                               $wdot .= "$_\n";
-                       }
-                       # $dot =~ s/(?<!")\b(?!(?:digraph|stemma)\b)(\w+)\b(?!")/"$1"/g;
-                       $dot = $wdot;
-                       print STDERR "$dot\n";
                        try {
                                if( $stemmaid eq 'n' ) {
                                        # We are adding a new stemma.
index ac4e005..ff4f69b 100644 (file)
@@ -9,6 +9,17 @@ use Text::Tradition::Stemma;
 
 BEGIN { extends 'Catalyst::Controller' }
 
+has idp_solver_url => (
+       is => 'ro',
+       isa => 'Str',
+       predicate => 'has_idp_solver_url',
+       );
+
+has idp_calcdsn => (
+       is => 'ro',
+       isa => 'Str',
+       predicate => 'has_idp_calcdsn',
+       );
 
 =head1 NAME
 
@@ -72,8 +83,12 @@ sub index :Path :Args(2) {
                } elsif( $ignore_sort eq 'orthographic' ) {
                        $analysis_options{'merge_types'} = 'orthographic';
                }
+               if( $self->has_idp_solver_url ) {
+                       $analysis_options{'solver_url'} = $self->idp_solver_url;
+               } elsif( $self->has_idp_calcdsn ) {
+                       $analysis_options{'calcdsn'} = $self->idp_calcdsn;
+               }
 
-               # Do the deed
                my $t = run_analysis( $tradition, %analysis_options );
                # Stringify the reading groups
                foreach my $loc ( @{$t->{'variants'}} ) {
index 14dc998..b856c61 100644 (file)
@@ -1,6 +1,9 @@
 # rename this file to stemmaweb.yml and put a ':' after 'name' if
 # you want to use YAML like in old versions of Catalyst
 name = stemmaweb
+<Component Controller::Stexaminer>
+    idp_solver_url http://perf.byzantini.st/cgi-bin/graphcalc.cgi
+</Controller>
 <Model Directory>
     dsn dbi:SQLite:dbname=db/traditions.db
 </Model>