[Dancer-users] Problem with using the prefix feature to split the application
franck
franck at lumberjaph.net
Sat Oct 2 20:26:20 CEST 2010
Hi
I was using the following idiom, and everything was working fine
>
> ----
> package app;
> use Dancer ':syntax';
> use Dancer::Plugin::Ajax;
>
> load_app "app::app1", prefix => "/app1";
> load_app "app::app2", prefix => "/app2";
>
> ..
>
> true;
> ----
>
> package app::app1;
> use Dancer ':syntax';
>
> ..
>
> true;
> ----
>
> package app::app2;
> use Dancer ':syntax';
>
> ..
>
> true;
> ----
>
> The above was a holdover from earlier versions of Dancer, but, as I
> noted above, it was working fine. Today I noticed that the
> Dancer::Cookbook has a different suggestion, so I implemented that and
> ran into a problem. My new implementation is
>
> ----
> package app;
> use Dancer ':syntax';
> use Dancer::Plugin::Ajax;
>
> use app::app1;
> use app::app2;
>
> prefix undef;
>
> ..
>
> true;
> ----
>
> package app::app1;
> use Dancer ':syntax';
> prefix 'app1';
> ..
>
> true;
> ----
>
> package app::app2;
> use Dancer ':syntax';
> prefix 'app2';
> ..
>
> true;
> ----
>
> I get the following error
>
> Error while loading /Users/punkish/Sites/app/app.pl: unable to load
> application app : not a valid prefix: `app', must start with a / at
> /usr/local/lib/perl5/site_perl/5.12.1/Dancer/App.pm line 32., referer:
> http://app.local/app1/
>
> What gives?
>
> a prefix must start with '/', if the '/' is missing in the cookbook, it's
an error, and that will be fixed right away.
However, I prefer your first solution :) (load_app "app::app1", prefix =>
"/app1";)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20101002/922f1880/attachment.htm>
More information about the Dancer-users
mailing list