[Catalyst] Catalyst and Dist::Zilla?

Eden Cardim edencardim at gmail.com
Fri Jul 6 17:11:58 GMT 2012


>>>>> "Bill" == Bill Moseley <moseley at hank.org> writes:

    Bill> So you are saying move root to share/root and let everything in root
    Bill> get managed like a share directory?   

    Bill> $c->path_to uses $c->config->{home} as its base.   So, it's really
    Bill> $c->config->{home} that would need to be changed, right?   $c->
    config-> {root} is based of $c->config->{home}, too.   Which means
    Bill> everything in the app's home directory would need to move, too --
    Bill> like config.yml (or whatever you use) and any other files or
    Bill> directories that were placed there.

Yeah, and I always move my configuration files somewhere outside the
root of the app anyway.

    Bill> File::ShareDIr also acts a bit differently than how the current home
    Bill> and root work.

    Bill> For example, "prove -vl t/test.t" and "prove -vb t/test.t"  (lib vs.
    Bill> blib) currently will both use the same home (and therefore root).  
    Bill> Since -b uses blib/lib then Catalyst probably should also use blib/
    Bill> lib/<App>/root to be consistent, right?

Yes, this is an area I'm still not comfortable with, what I ended up
doing as a quick hack was creating symlinks into share/.

    Bill> File::ShareDire might help that, though.

    Bill> File::ShareDir expects an auto directory -- so "prove -vl" won't work
    Bill> (because File::ShareDir expectes to find lib/auto which likely
    Bill> doesn't exist in the source).

    Bill> "prove -vb" works because File::ShareDir looks for blib/lib/auto/
    Bill> <App>, and things in "share"get copied then when running "make".

    Bill> I tend to use prove -vl quite often, so that's a problem when also
    Bill> using File::ShareDir.  (Maybe there's a solution I'm not aware of).

  my $share_dir = eval { File::ShareDir::dist_dir('MyApp') };
  __PACKAGE__->config(home => $share_dir) if $share_dir;

This has worked fine for me, if there's sharedir it means the app has
been installed. As long as you don't have the app installed in your dev
environment (and you don't want that for a myriad of reasons anyway), it
should work fine. What's dangerous about this is that if you end up
installing the app in your dev environment for some reason, things can
get *very* confusing, so maybe an alert warning about it somewhere would
be in order.

    Bill> I like the idea of using share for root -- just because it uses the
    Bill> Makefile to copy files (when needed) instead of
    Bill> Module::Install::Catalyst's method of copying all files every time
    Bill> when running Makefile.PL.  I've got over 5500 files in my root.

    Bill> Maybe all that's needed is Catalyst::Util's home function to figure
    Bill> out if running out of lib or from an installed location (prove -l
    Bill>  vs. prove -b) so it can use the right "root" using existing methods
    Bill> or via File::ShareDir.

It already does the installed vs checkout verification, all that's
lacking is the sharedir integration.

    Bill> Still, not sure I'd want to move the app configuration out of the app
    Bill> home.

You still need a place for the config to live when you install the app.

-- 
Eden Cardim
+55 11 9644 8225



More information about the Catalyst mailing list