In the following code cut/paste out of Chart.pm from the DBIx::Chart package, it appears to me that the execute subroutine is incorrectly reversing the order of the arguments.
Ie:

$dbh->execute($arg1, $arg2);
becomes
$dbh->execute($arg2, $arg1);

From DBIx::Chart:
sub execute { my ($sth, @args) = @_; return $sth->SUPER::execute(@args) unless $sth->{private_dbix_chart_sth}; # # first execute each source sth, then execute the chart sth, # passing in the source sth's as a param, and picking up any # other placeholders we might need my @exec_parms; my $chartsth = $sth->{private_dbix_chart_sth}; my $src_sths = $chartsth->{_src_sths}; my $src_phs = $chartsth->{_src_phs}; my $chart_phs = $chartsth->{_chart_phs}; my $phcnt = $chartsth->{_chart_src_idx}; my $rc; foreach my $i (0..$#$src_sths) { @exec_parms = (); if (@args > 0) { push @exec_parms, $args[$_] #<--line 403 foreach (@{$src_phs->[$i]});
I tracked down this section of code when trying to understand why a query was returning undef from execute. The query received two arguments and they were being transposed, which resulted in the undef. Changing line 403 from
push @exec_parms, $args[$_]
to
unshift @exec_parms, $args[$_]
seems to fix my problem without any adverse affects. I wonder, though, whether it's truly this simple? Surely this code is used enough (I've seen references to DBIx::Chart all over the place) that I'm not the first to see this. Is there some purpose in transposing the arguments that I haven't been able to discern?

Update: Linkified the references to the cpan module

In reply to Why does DBIx::Chart reverse order of query args by jrsimmon

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.