[dancer-users] Reaching a route defined at another .pm file

Kadir Beyazlı kadirbeyazli at gmail.com
Sun Sep 13 13:55:47 BST 2015


Hi All,

I added 6th and 8th line to file  bin/app.psgi and it found route
defined at Product.pm but this time the routes defined at myproject.pm
are not working

#!/usr/bin/env perl

1 use strict;
2 use warnings;
3 use FindBin;
4 use lib "$FindBin::Bin/../lib";

5 use myproject;
6 use Product;

7 adopen->to_app;
8 Product->to_app;

On Sun, Sep 13, 2015 at 3:43 PM, Kadir Beyazlı <kadirbeyazli at gmail.com> wrote:
> Hi All,
>
> At my project all routes are defined at same file : myproject.pm as follow:
>
> get /product {
>
> }
>
> get /store {
>
> }
>
> get /user {
>
> }
>
> Then I decided to put each logical item into separate file as follow,
> for example I created Product.pm for product operations.
>
> #Product.pm
> package Product;
> use Dancer2;
>
> get /product {
>
> }
>
>
> At file myproject.pm I added package Product as follow and removed
> route from this file
>
> myproject.pm
>
> package myproject;
> use Dancer2;
> use Dancer2::Plugin::Database;
> use Product;
>
> But it can not find get /product route which was working when it was
> at myproject.pm
>
> How can I do it?
>
> --
> Kadir Beyazlı
> GSM : +90 535 821 50 00



-- 
Kadir Beyazlı
Computer Engineer
GSM : +90 535 821 50 00


More information about the dancer-users mailing list