added new idea for a usecase
Robin Edwards [Thu, 18 Feb 2010 14:36:10 +0000 (14:36 +0000)]
examples/Perl6If.pm [new file with mode: 0644]
t/usecase/if.t [new file with mode: 0644]

diff --git a/examples/Perl6If.pm b/examples/Perl6If.pm
new file mode 100644 (file)
index 0000000..49b7f95
--- /dev/null
@@ -0,0 +1,28 @@
+package SQL;
+use lib 'lib/';
+use Keyword qw/debug/;
+use Carp;
+use Data::Dumper;
+
+our $DBH;
+
+keyword if (if) {
+}
+
+parse if ($kd) {
+       my $stmt = $kd->strip_to_char('{');
+#      $kd->terminate;
+
+       my ($exp)  =~ /if\s+(.+)\s*{/;
+
+       $kd->line("if ($exp) {");
+
+       return $exp;
+}
+
+action sql ($exp) { 
+       return $exp;
+}
+
+
+1;
diff --git a/t/usecase/if.t b/t/usecase/if.t
new file mode 100644 (file)
index 0000000..fa5c515
--- /dev/null
@@ -0,0 +1,17 @@
+use Test::More qw/no_plan/;
+use strict;
+use warnings;
+use lib 'examples/';
+use Perl6If;
+use Data::Dumper;
+
+ok 1;
+
+if 1 {
+       ok 1 ;
+}
+else {
+       nok 1;
+}
+
+ok 1;