Alexis Sukrieh wrote, On 10/03/2011 12:30 PM:
2011/10/3 Assaf Gordon <gordon@cshl.edu>:
Changing the template engine to "template_toolkit" simply changes the error message to: Yeah, the syntax changed, you should do the following in your config:
template: "toolkit"
That solved it. A minor difference (from Dancer 1): In the "index.tt" template, there's a sidebar which contains: ===== <h3>Your application's environment</h3> <ul> <li>Location: <code>/home/gordon/projects/dancer_test/MyFirstApp</code></li> <li>Template engine: <code><% settings.template %></code></li> <li>Logger: <code><% settings.logger %></code></li> <li>Environment: <code><% settings.environment %></code></li> </ul> ===== With Dancer 1, the output is : === Your application's environment Location: /home/gordon/projects/dancer_test/MyFirstApp Template engine: simple Logger: console Environment: development === With Dancer 2, the output is: === Your application's environment Location: /home/gordon/projects/dancer_test/MyFirstApp Template engine: Dancer::Template::Toolkit=HASH(0x188dcb8) Logger: Dancer::Logger::Console=HASH(0x1602758) Environment: === That is - with the "HASH(0x188dcb8)" part of the engine & logger objects. Also - it seems "environment" is not set, but perhaps that's another (updated) configuration option that I'm missing.
[...]
Problem 2: Cannot combine a prefix (/testme) with a regular expression ((?-xism:.*)) at (eval 72) line 74
Hmm, this looks to be a regression, but can you make sure it actuallt works under Dancer1 ?
Yes, it works with Dancer1. Here's how to reproduce: ========= ## ## Create a new application ## $ dancer -a d2test4 [...] $ cd d2test4/ ## ## Add a "prefix" statement ## $ sed -i '6iprefix "/testme";' lib/d2test4.pm ## ## show the updated application ## $ cat lib/d2test4.pm package d2test4; use Dancer ':syntax'; our $VERSION = '0.1'; prefix "/testme"; get '/' => sub { template 'index'; }; true; ## ## Run with Dancer 1 ## $ ./bin/app.pl [15837] core @0.000008> loading Dancer::Handler::Standalone handler in /usr/local/share/perl/5.12.4/Dancer/Handler.pm l. 41 [15837] core @0.000163> loading handler 'Dancer::Handler::Standalone' in /usr/local/share/perl/5.12.4/Dancer.pm l. 366
Dancer 1.3072 server 15837 listening on http://0.0.0.0:3000 == Entering the development dance floor ... [15837] core @0.000123> request: GET /testme/ from 127.0.0.1 in /usr/local/share/perl/5.12.4/Dancer/Handler.pm l. 52 [15837] core @0.000502> [hit #1]trying to match `/testme/' against /(?-xism:^(?-xism:^\/testme(?:\/)?$)$)/ in /usr/local/share/perl/5.12.4/Dancer/Route.pm l. 78 [15837] core @0.000641> [hit #1] --> got 1 in /usr/local/share/perl/5.12.4/Dancer/Route.pm l. 95 [15837] core @0.006332> [hit #1]response: 200 in /usr/local/share/perl/5.12.4/Dancer/Handler.pm l. 167 ^C
## ## Run with Dancer 2 ## $ perl -I /home/gordon/sources/dancer2/lib ./bin/app.pl core: binding app to main core: binding app to d2test4 core: [d2test4] running 'prefix' with /testme core: [d2test4] running 'get' with /, CODE(0x2b082b8) core: [d2test4] running 'true' with core: [main] running 'dance' with Cannot combine a prefix (/testme) with a regular expression ((?-xism:.*)) at (eval 72) line 74 ====== I did not change the "config.yml" file with the correct template syntax, but I assume it is not relevant for this behavior. -gordon