Subject: | Querylet 0.323 produces no output if comment is at EOF |
Date: | Wed, 23 Jan 2008 20:57:09 +0100 |
To: | bug-querylet [...] rt.cpan.org |
From: | Max Maischein <corion [...] corion.net> |
Hello Ricardo,
first of all, many thanks for writing Querylet - it's incredibly
convenient to use.
I found a small niggle - Querylet does (silently) fail if there is a
comment in the last line and there is no newline as the last char of the
Perl source code.
Attached is the patch plus test file (as a Querylet itself). The test
file requires DBD::SQLite though, so you might not want to distribute
the test or maybe build in some precautions that check that DBD::SQLite
is installed and bail out if not.
I also have some other suggestions for Querylet, but these will come in
a separate mail.
Thanks again,
-max
--- Querylet.pm.323 Thu Nov 16 14:31:23 2006
+++ Querylet.pm Wed Jan 23 20:53:17 2008
@@ -10,13 +10,13 @@
=head1 VERSION
-version 0.323
+version 0.323_1
$Id: /my/cs/projects/q/querylet/trunk/lib/Querylet.pm 28140 2006-11-15T20:06:44.831426Z rjbs $
=cut
-our $VERSION = '0.323';
+our $VERSION = '0.323_1';
=head1 SYNOPSIS
@@ -566,7 +566,7 @@
/egmsx;
s/\Z
- /once('output',output)
+ /"\n" . once('output',output)
/egmsx;
}
package main;
use Querylet;
use Querylet::Output::Text;
database: dbi:SQLite:dbname=:memory:
print "1..1\n";
#my $dbh = $q->{dbh};
for (split /;\n/, <<'SQL') {
CREATE TABLE mytable (
output VARCHAR(16)
);
INSERT INTO mytable (output) VALUES ('ok 1 - output gets displayed');
SQL
$dbh->do($_)
};
query:
select *
from mytable
$q->set_headers({'output' => '#output'});
output format: text
# Comment at EOF without a trailing newline