Subject: | Newlines stripped from queries |
Date: | Thu, 15 Aug 2013 21:54:43 +0000 |
To: | bug-File-Slurp [...] rt.cpan.org |
From: | Daniel Fackrell <unlearned [...] gmail.com> |
File::Slurp's new() splits on newlines, and then inserts the lines of
the query without adding them back in. The resulting query when
called later is a single line.
This causes problems with queries that contain SQL-style comments
(though three other types of comments work well), as the rest of the
query from that point is considered a comment.
While three other types of comments are recognized by the parsing in
this module, comments beginning with '--' should work and be passed to
the SQL server without modification.
Recommended fix:
Change:
if ( $curr_name )
{
$self->{'contents'}->{$curr_name} .= $_;
}
To:
if ( $curr_name )
{
$self->{'contents'}->{$curr_name} .= $_ . "\n";
}
This adds the newline back to the end of each line.