X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-live.git;a=blobdiff_plain;f=yarrg%2Fweb%2Fcheck_capitalstring;h=53aceecd975dcfacd3255f2cbbd51f8d29e04a29;hp=90148c64e38598a74d7cce76a81e176ea8576d77;hb=a1fb96b672d234f5961a397215c19c2c631c5cc3;hpb=1a64a4e4703ade43ff0b26150f8128969be0ec8b diff --git a/yarrg/web/check_capitalstring b/yarrg/web/check_capitalstring index 90148c6..53aceec 100644 --- a/yarrg/web/check_capitalstring +++ b/yarrg/web/check_capitalstring @@ -33,31 +33,30 @@ -<%attr> - - -<%method preparse> +<%method execute> <%args> -$h +$string +$dbh +$debugf <%perl> -$_= ${ $h->{String} }; +$_= $string; s/^\s+//; s/\s+$//; -my $res= sub { - my ($capital) = @_; - push @{ $h->{Results} }, [ $capital ]; - ${ $h->{Canon} }= "$capital PoE"; -}; +my $capital; +my $canon; if (!m/\S/) { + $canon= ''; } elsif (m/^([1-9]\d*)( PoE)?$/i) { - $res->( $1 ); + $capital= $1; + $canon= "$capital PoE"; } else { - ${ $h->{Emsg} }= "Cannot understand capital \`$_'."; - return; + expected_error("Cannot understand capital \`$_'."); } +return ($canon,$capital); +