I can't comment on your question regarding the disabling of package however I have spent some time trying to build an SQL DSL in Perl.

One issue you will likely face is dealing with things like "or" and "and" short-circuiting: as soon as Perl sees a true value on the left side of "or" or a false value on the left side of "and" it does not evaluate/execute the other term. Another issue is the flattening of "(" and ")" lists losing information you need to pass on to the database.

The best thing that I could come up with was parsing a list as special key/value pairs like so:

my $pinfo = $self->db->xhashref( select => [ 'n.id', 'p.hash' ], from => 'nodes n', inner_join => 'projects p', on => 'p.id = n.id', where => { 'n.uuid' => $uuid }, ); # Try and do this with an ORM! $dbw->xdo( insert_into => [ 'func_new_topic_status', qw/change_id id project_id tkind status rank def bill/, ], select => [ qv( $opts->{change_id} ), 'nextval("nodes")', qv( $opts->{id} ), 'ts.tkind', 'ts.status', 'ts.rank', 'ts.def', qv( $opts->{bill} // 1 ), ], from => 'topic_status ts', where => { 'ts.project_id' => $dup_pinfo->{id} }, order_by => [qw/ts.tkind ts.rank/] );

The DBIx::ThinSQL module contains my latest efforts. Unfortunately the documentation status is woefully wrong, but it functions (in my very humble opinion) far more powerfully and efficiently that any ORM or other SQL DSLs I've seen on CPAN.


In reply to Re: [DSL] disabling packages in Perl? by mlawren
in thread [DSL] disabling packages in Perl? by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.