[dancer-users] Questions about distributing Dancer2 applications
cymon.ML at gmail.com
Tue May 6 22:22:49 BST 2014
I released a Dancer2 App too, so let me tell you what I think about the
issues you're talking about.
In my opinion, releasing your app the way you want it's... well, not
releasing it. I think that if your only need is to make users
download your app and using it you should just make a tarball out of it
and find a smart way to manage dependencies.
Releasing your app (that is still releasing a perl module, at last)
must involve your local repository and its paths because that's the
essence of a release.
Actualy there's no problem placing your app in a common @INC path and
using it in a Dancer2 project. Your app is a perl module so, in your
bin/app.pl, you can just import it with a use directive:
use lib "$FindBin::Bin/../lib";
It's what I do here:
Ok, you'll need a bit of fine tuning about relative paths, but nothing
impossibile to do.
Well, why hardcoding the server? Very few HTML magic is needed:
A brutal find and replace in your code putting the server name is, in
my opinion, a very bad idea. If you need the explicit name in the pages
just make it an entry in the config.yml and then write a little piece
of code adding this entry in every template parameters hash.
Talking about static elements and release question (as at 1.). If you
realese "the real way" your app probably you statics elements (your
public directory) will go in a very dark and gloomy place, difficult to
be served by a webserver. For this, I suggest you to create a script
that "sync" the public directory of the deployed app with the contents
in your package.
> I have a Dancer2 application that I'd like to distribute. I have a
> couple of questions about the process that may be more related to
> ExtUtils::MakeMaker than to Dancer, but I figured I'd ask here first
> since deployment of web applications seems a little different from
> installing regular modules.
> 1. Typically when you install a Perl package with
> perl Makefile.PL && make && make install
> modules goes somewhere like /usr/local/lib/perl5/, binaries go
> somewhere like /usr/local/bin/, documentation goes somewhere else,
> and so on. I don't want my application fragmented like that (and I
> don't think it would even work if it were); when users run `make
> install` I want everything from my MANIFEST to simply be copied into
> the install directory as-is. For example, I want to end up with
> I assume this is how most Dancer/Dancer2 apps would have to be
> installed to work properly...how can I do this? I tried
> perl Makefile.PL INSTALL_BASE=/usr/local/myapp/
> but that puts myapp.pm in /usr/local/myapp/lib/perl5/ and doesn't
> copy any of the other files or directories I want, like public/.
> 2. My app includes an index page containing links to other pages on
> the same server, e.g.
> <a href="http://host.example.com/foo">foo</a>
> This page is served with send_file, no templates involved. So far I
> have simply hard-coded the server name into the file, but that won't
> work when somebody tries to install it on another server.
> I thought I could use the PL_FILES attribute to WriteMakefile() to
> run a script that fills in the correct host name during the build
> process. Would this be a reasonable approach?
> dancer-users mailing list
> dancer-users at dancer.pm
More information about the dancer-users