[Dancer-users] get the right lib path

Puneet Kishor punk.kish at gmail.com
Mon Jan 17 02:21:07 CET 2011


I am trying to build a little framework for myself with some custom 
functionality. Consider the following

/Users/punkish/Sites/app/lib/mydance.pm
---------------------------------------
package mydance;
use Dancer ':syntax';
use Dancer::Plugin::Email;
use Crypt::GeneratePassword;
use DBI;

prefix '/mydance';
get '/' => sub { template '/index', opts(); };
sub opts { return { app_name => config->{app_name} } }

/Users/punkish/Sites/app/lib/app.pm
-----------------------------------
package app;
use Dancer ':syntax';
use base 'mydance';

get '/' => sub { template 'index.tt', __PACKAGE__->SUPER::opts(); };

-----

If I remove the `use base 'mydance'` line and remove the call to 
`__PACKAGE__->SUPER::opts()` the above works, but of course, the app is 
not base-d on mydance. With the code as above, I get the dancer 404 
"this is the void" message.

What am I doing wrong?

Eventually, I would like to move mydance to some other central location 
that would be in @INC, so other applications I develop can also be 
base-d on mydance.

Puneet.


More information about the Dancer-users mailing list