This trait definition:
role Query { }
role DefaultQuery does Query { }
multi sub trait_mod:<is> (Method $m, :$default-query is required) {
$m does DefaultQuery;
$m.wrap(method (|c) {
my $sth = $dbh.prepare( _getSQL($m) );
$sth.execute;
$sth.allrows;
});
}
Now when I use it on a method like this:
#| SELECT url, name
#| FROM control_records
#| WHERE state = 1
#| ORDER BY url, name
multi method getActiveSites {
}
It gives me the following error when I try to compile it using cro run
:
Lexical with name '$m' does not exist in this frame
at /home/cbwood/Work/.../CountCollector/app/lib/MyApp/Queries.pm6 (MyApp::Queries):101
at /home/cbwood/Work/.../CountCollector/app/service.p6:3
Might someone familiar with Cro have some idea as to why this is occurring?
So removing BRT solved the issue. All that was supposed to do would be to allow Cro::WebApp::Templates to come from strings rather than files. Here's that code: