[% USE DBI; USE WebSession; USE utils = WebUtils; USE testdoc = XML::LibXML(config_xml); userid = 1; dbname = testdoc.findvalue('/reporter/setup/database/name'); dbhost = testdoc.findvalue('/reporter/setup/database/host'); d_u = testdoc.findvalue('/reporter/setup/database/user'); d_p = testdoc.findvalue('/reporter/setup/database/password'); dsn = "dbi:Pg:dbname=" _ dbname _';host=' _ dbhost; ''; DBI.connect(dsn,d_u,d_p); %]

Reports: yay!

[% PROCESS PRINT_STAGE1 %] [% BLOCK PRINT_STAGE1 %] [% FOR s1 IN DBI.query("select * from reporter.stage1 where pub is true;"); USE doc = XML::LibXML(s1.filename); %] [% END %]
Name: [%doc.findvalue('/reporter/report/@name')%] Description: [%doc.findvalue('/reporter/report/description')%] Visible Stage2 reports: [% q = 'select count(*) as x from reporter.stage2 ' _ 'where pub is true or owner = ' _ userid; FOR r IN DBI.query(q); r.x; END %]
[% END %]