You may know, by default Catalyst applications are valid cpan modules, with the application name as root namespace.
Now that i'm designing Mojo with usability in mind i can't think of a good reason for keeping that format.
When i made the decision 1 1/2 years ago for Catalyst i thought it would be useful to be able to upload applications to cpan, but today there is only one!
Installing the applications on a host system doesn't make much sense either, so why do it again?
With the old format a Mojo app would look like this:
TestApp
TestApp/lib
TestApp/lib/TestApp
TestApp/lib/TestApp/Component
TestApp/lib/TestApp/Component/Example.pm
TestApp/lib/TestApp/Context.pm
TestApp/lib/TestApp/Dispatcher
TestApp/lib/TestApp/Dispatcher/Example.pm
TestApp/lib/TestApp/SomethingElse.pm
TestApp/lib/TestApp.pm
TestApp/Makefile.PL
TestApp/script
TestApp/script/testapp_server.pl
TestApp/t
TestApp/t/01use.t
A newer (non valid) version could look like this.
TestApp
TestApp/Component
TestApp/Component/Example.pm
TestApp/Dispatcher
TestApp/Dispatcher/Example.pm
TestApp/SomethingElse.pm
TestApp/Context.pm
TestApp/Application.pm
TestApp/Makefile.PL
TestApp/script
TestApp/script/server.pl
TestApp/t
TestApp/t/01use.t
The basic layout for scripts and tests makes sense and can naturally stay...
Can this be done by customizing the Makefile.PL with
PMLIBDIRS => [ qw( Component Dispatcher ) ]
so that it searches those directories instead of lib
?
-xdg
I can't think of a good reason either. When I am able to use Mojo on Windows (stuck on that at work), I probably would most definately not upload as a CPAN "module".
On another note, is there something somewhere that will tell what you "thoughts" for building Mojo are?
I don’t see a big win in getting rid of two path components on a few of the files.
That structure is too flat anyway, IMHO. I’d want the modules in TestApp::
grouped together separately from other miscellanea, and that has nothing to do with CPAN. So there should be at least one extra TestApp/
in there. At that point, having an extraneous lib/
makes no difference.
And as Alias said, just because very few Cat apps got uploaded to CPAN doesn’t mean it won’t come handy in a surprising moment. You never know.
By making it a CPAN module one can easily install all of its dependencies from CPAN, as well as upgrade and keep track of them all. If it's an application in a custom layout, it's more difficult this way.