[Dancer-users] a couple of questions re. Plugins

Puneet Kishor punk.kish at gmail.com
Fri Dec 2 19:04:19 CET 2011


Thanks David,

Your reply is a great help.


On Dec 2, 2011, at 11:38 AM, David Precious wrote:

> On Friday 02 December 2011 16:48:26 Puneet Kishor wrote:
>> Of course, continuing to refine DPM while under "lib" is a pain in the ass
>> because I have `sudo` every time, and, besides, I don't want to break my
>> existing apps while I further experiment with DPM. So, I made a copy of
>> DPM in my own home directory. To share it with the rest of the world, I
>> also made that home directory version into a git repo, and put it on
>> github.
>> 
>> So, now I have
>> 
>> 	/opt/local/lib/perl5/site_perl/5.14.1/Dancer/Plugin/Meta.pm which is
>> currently powering my apps ~/Projects/Dancer/Plugin/Meta.pm which is a git
>> repo and where I continue to hack it
> 
> Firstly, I'd recommend adopting the usual layout of a CPAN module of a dir 
> named Dancer-Plugin-Meta, containing lib/Dancer/Plugin/Meta.pm, along with a 
> makefile, tests, etc.  It's much easier to use e.g. Module::Starter to rock 
> that up for you.


Heh, heh... you might be amused to note that I just downloaded D::P::Database and used that as a template. Your plugin was my Module::Starter.


> 
> 
> Also, I'd recommend not manually editing/creating stuff under your site_perl 
> directories - reserve that for modules actually installed via the CPAN 
> toolchain.
> 

Right... that is what I want to learn.


> 
>> I am not knowledgable about the workflow whereby I can make experimental
>> changes to ~/Projects/Dancer/Plugin/Meta.pm and test it in the development
>> versions of my apps, and when I am satisfied with the changes, update my
>> site_perl version with the new version (Of course, pushing the changes to
>> github is easy).
>> 
>> Any guidance on this would be appreciated.
> 
> 
> ..
> 
> Of course, you could just add a "use lib ..." statement to your app while 
> you're working on it, but that's a little bodgier :)


Actually, I just used `use lib` and while verbose, it works quite well. Now, my follow-up question is to confirm the sanity of the following workflow --

    1. ~/Projects/Dancer-Plugin-Meta/  which has the usual CPAN module layout and is also a git repo
    2. github/punkish/Dancer-Plugin-Meta  the git repo for the world
    3. /opt/../site_perl/5.14.1/Dancer/Plugin/Meta  where the production version will get installed
    4. ~/Sites/app/lib/app.pm   which has 
        use lib ('~/Projects/Dancer-Plugin-Meta/lib');
        use Dancer::Plugin::Meta;

I hack on Meta.pm under #1 above, and check if it is working well in #4 above. Once all is copacetic, I `git push` #1 to update #2. And, I do a `perl Makefile.PL && make && sudo make install` in #1 to update #3. Once I send my plugin to CPAN, I can use other cpan tools do this final bit as well.

Does that make sense?

--
Puneet Kishor



More information about the Dancer-users mailing list