chiark / gitweb /
WIP improve intro etc. - howto page from Naath
[ypp-sc-tools.main.git] / yarrg / web / check_capitalstring
index 90148c64e38598a74d7cce76a81e176ea8576d77..53aceecd975dcfacd3255f2cbbd51f8d29e04a29 100644 (file)
 
 </%doc>
 
-<%attr>
-</%attr>
-
-<%method preparse>
+<%method execute>
 <%args>
-$h
+$string
+$dbh
+$debugf
 </%args>
 <%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);
+
 </%perl>
 </%method>