[Dancer-users] separating code into packages

sawyer x xsawyerx at gmail.com
Sat Dec 25 12:35:37 CET 2010


On Sat, Dec 25, 2010 at 11:01 AM, Gabor Szabo <szabgab at gmail.com> wrote:

> In the end I found some other way. I am not sure if it is blessed by
> the Dancer developers or not:
>
> my $prefix = Dancer::App->current->prefix();
> load_app "Foo::User", prefix => "$prefix/user";
> Dancer::App->current->prefix($prefix);
>

Actually, I do something much simpler.

I have a Foo::User.pm, which has:
package Foo::User;
use Dancer ':syntax';
prefix '/user';

get '/' => sub {...};
get '/view/' => sub {...};
--

Then from Foo.pm, I set up:
load path( qw/ Foo User.pm / );

That's it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20101225/a59d21b7/attachment.htm>


More information about the Dancer-users mailing list