Permalink
Browse files

Refactor PL/Perl6 grammar example to use boolean context

  • Loading branch information...
leto committed Aug 19, 2010
1 parent 804ec61 commit 801ddfd1f0d739b2214c9ae6ebffb083510a5da0
Showing with 2 additions and 2 deletions.
  1. +2 −2 t/sql/plperl6.sql
View
@@ -97,6 +97,7 @@ $$;
CREATE OR REPLACE FUNCTION test_grammar(text) RETURNS integer LANGUAGE plperl6 AS $q$
($item) {
+ # This grammar needs a 'my' because the default is 'our' i.e. package scope
my grammar Inventory {
regex product { \d+ }
regex quantity { \d+ }
@@ -110,8 +111,7 @@ CREATE OR REPLACE FUNCTION test_grammar(text) RETURNS integer LANGUAGE plperl6 A
$$
}
}
- return 1 if Inventory.parse($item);
- return 0;
+ return ?Inventory.parse($item);
}
$q$;

0 comments on commit 801ddfd

Please sign in to comment.