Search code examples
perlperl-modulecpandancer

Using CPAN to install Dancer and dependencies


I am trying to create a sample web service using Dancer. I am using Ubuntu 10.04 as my OS. I installed Dancer and dependencies using CPAN client and can also do

dancer -a MyApp

However, when I try to run the app.pl file, the code throws an error saying YAML.pm not found. I am sure this file was downloaded when the dependencies were installed. A have a few questions :-

1. Where does CPAN put all these files which were downloaded? How are they included in the @INC?
2. For using Dancer, do I have to manually include all the files in @INC?

I tried to create a very simple perl dancer app the says hello world by including the Dancer.pm path in @INC. However, it keeps failing because of some or the other dependency missing.

Help me in understanding what am I doing wrong?


Solution

  • cpan should put files in one of the path from @INC
    perl -E '$"="\n"; say "@INC"'
    Output on my system:

    /etc/perl
    /usr/local/lib/perl/5.14.2
    /usr/local/share/perl/5.14.2
    /usr/lib/perl5
    /usr/share/perl5
    /usr/lib/perl/5.14
    /usr/share/perl/5.14
    /usr/local/lib/site_perl
    .
    

    And cpan puts files in /usr/local/share/perl/5.14.2
    Because this path exists in @INC you shouldn't include it manually. And what about Dancer, YAML is not hard dependency for it, because of this it wasn't installed.