#!perl use warnings; use strict; package SQL_DSL; use Exporter 'import'; our @EXPORT_OK = qw/SQL WHERE/; use Carp; sub SQL (&;@) { # $SQL_DSL::IN_SQL is *not* required when using # SQL_DSL_Transform or SQL_DSL_Keyword croak "Already in SQL block" if $SQL_DSL::IN_SQL; local $SQL_DSL::IN_SQL = 1; print "Exec SQL\n"; # Debug shift->(@_) } sub WHERE (&;@) { croak "WHERE not in SQL block" unless $SQL_DSL::IN_SQL; print "Exec WHERE\n"; # Debug shift->(@_) } package LIKE; use Carp; sub AUTOLOAD { our $AUTOLOAD; croak "$AUTOLOAD not in SQL block" unless $SQL_DSL::IN_SQL; print "Exec $AUTOLOAD (@_)\n"; # Debug } 1;