[Dancer-users] Structuring Dancer Application

Geistteufel geistteufel at yahoo.fr
Sun Mar 27 01:46:15 CET 2011


Well :

in libs, add web/root.pm and web/forum.pm

in web/root.pm

get '/' => sub { ... }

in web/forum.pm

get '/forum' => sub { ... }

and include all of these to bin/app.pl

use Web::Root;
use Web::Forum;

Hope can help :)

Le 26 mars 2011 à 05:35, Naveed Massjouni a écrit :

> On Fri, Mar 25, 2011 at 8:01 PM, Forgoselo Fontardion
> <fontardion at gmail.com> wrote:
>> Hello,
>> 
>> Thank you for answering my question.
>> 
>> Maybe I didn't explain the question correctly.I want to be able to split the
>> logic in diferent modules. In your example:
>>      "/" calls Web::Root, how do you call Web::Root from web.pm?
>>      "/forums" calls Web::Forum, how do you call Web::Forum from web.pm?
> 
> === web.pm ===
> use Dancer ':syntax';
> use Web::Root;
> get '/' => sub { Web::Root::foo() };
> get '/forums' => sub { Web::Forum::bar() };
> 
> Is that what you want?
> -Naveed
> 
>> 
>> 
>> Best regards,
>>                   Fontardion
>> 
>> 2011/3/25 sawyer x <xsawyerx at gmail.com>
>>> 
>>> Hey guys,
>>> 
>>> On Thu, Mar 24, 2011 at 10:49 PM, Brian E. Lozier <brian at massassi.com>
>>> wrote:
>>>> 
>>>> 
>>>> http://search.cpan.org/~sukria/Dancer-1.2005/lib/Dancer/Introduction.pod#PREFIX
>>> 
>>> Better use a more up-to-date version:
>>> http://search.cpan.org/perldoc?Dancer::Introduction
>>> 
>>> S.
>> 
>> 
>> _______________________________________________
>> Dancer-users mailing list
>> Dancer-users at perldancer.org
>> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>> 
>> 
> _______________________________________________
> Dancer-users mailing list
> Dancer-users at perldancer.org
> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users



More information about the Dancer-users mailing list