[dancer-users] Adding a second route to a simple crud.

Daniel Perrett dp13 at sanger.ac.uk
Mon Aug 3 16:08:53 BST 2015


You probably want a second call to simple_crud, as all you’re doing in the second example is overwriting the keys in the hash that is created from the arguments to simple_crud.

Daniel

From: dancer-users [mailto:dancer-users-bounces at dancer.pm] On Behalf Of Richard Reina
Sent: 03 August 2015 15:46
To: Perl Dancer users mailing list
Subject: [dancer-users] Adding a second route to a simple crud.


When I do this it works.



#!/usr/bin/perl



use Dancer;

use Dancer::Plugin::SimpleCRUD;



# Simple example:



simple_crud(



       record_title => 'Sponsor',

    prefix => '/sponsor',

    db_table => 'patron',

    editable => 1,

    deletable => 'no',

    sortable => 'yes',

    labels => {     # More human-friendly labels for some columns

        ID => 'Player ID',

        first_name => 'First Name',

        last_name => 'Last Name',

        email => 'Email',



    },



);



dance;



But, when I add a second record/route --like below. The second one works but the first does not.



richard at gemini:~$ wget -O - http://0.0.0:3000/sponsor

--2015-08-03 09:19:22--  http://0.0.0:3000/sponsor

Resolving 0.0.0 (0.0.0)... 0.0.0.0

Connecting to 0.0.0 (0.0.0)|0.0.0.0|:3000... connected.

HTTP request sent, awaiting response... 404 Not Found

2015-08-03 09:19:22 ERROR 404: Not Found.





Any insight as to what I am doing wrong? Thanks.



#!/usr/bin/perl



use Dancer;

use Dancer::Plugin::SimpleCRUD;



# Simple example:



simple_crud(



    record_title => 'Sponsor',

    prefix => '/sponsor',

    db_table => 'patron',

    editable => 1,

    deletable => 'no',

    sortable => 'yes',

    labels => {     # More human-friendly labels for some columns

        ID => 'Player ID',

        first_name => 'First Name',

        last_name => 'Last Name',

        email => 'Email',



    },





    record_title => 'Player',

    prefix => '/player',

   db_table => 'jugador',

    editable => 1,

    deletable => 'no',

    sortable => 'yes',

     labels => {     # More human-friendly labels for some columns

        ID => 'Player ID',

        first_name => 'First Name',

        last_name => 'Last Name',

        SEX => 'Gender',

        email => 'Email',



   },





);



dance;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20150803/b9053f76/attachment.html>


More information about the dancer-users mailing list