[Catalyst] reference lib outside Catalyst web applicationdirectory
Matt S Trout
dbix-class at trout.me.uk
Wed Dec 13 14:29:19 GMT 2006
On 13 Dec 2006, at 10:03, Hermida, Leandro wrote:
>
>> From: Matt S Trout [mailto:dbix-class at trout.me.uk]
>> On 12 Dec 2006, at 16:57, Hermida, Leandro wrote:
>>
>>> Hello,
>>>
>>> I have the following folder hierarchy for a project which
>> will have a
>>> web component that is driven by Catalyst:
>>>
>>> MyProj/
>>> lib/
>>> sql/
>>> web/ <--- Catalyst application dir created using catalyst.pl
>>> lib/
>>> root/
>>> script/
>>> t/
>>
>> Why not just make your Catalyst app as MyProj::Web so its
>> files live in
>>
>> MyProj/lib/MyProj/Web.pm
>> MyProj/lib/MyProj/Web/(Controller|Model|View)/...
>
> Hello,
>
> Sorry for not mentioning it in the original email but I did run
> catalyst.pl MyProj::Web to create the Catalyst project (based on your
> and A. Berlin's earlier advice, thank you) so that in the lib
> directory
> catalyst related stuff has its own namespace and separation. But it
> doesn't seem to fix the problem (maybe I am not seeing
> something?). It
> seems from what you suggest that then all web application stuff has to
> then be in the top-level MyProj folder. If I start over:
>
> [hermida at dla2 ~]$ catalyst.pl MyProj::Web
> created "MyProj-Web"
> created "MyProj-Web/script"
> created "MyProj-Web/lib"
> created "MyProj-Web/root"
> created "MyProj-Web/root/static"
> created "MyProj-Web/root/static/images"
> created "MyProj-Web/t"
> created "MyProj-Web/lib/MyProj/Web"
> created "MyProj-Web/lib/MyProj/Web/Model"
> created "MyProj-Web/lib/MyProj/Web/View"
> created "MyProj-Web/lib/MyProj/Web/Controller"
> created "MyProj-Web/myproj_web.yml"
> created "MyProj-Web/lib/MyProj/Web.pm"
> created "MyProj-Web/lib/MyProj/Web/Controller/Root.pm"
> created "MyProj-Web/README"
> created "MyProj-Web/Changes"
> created "MyProj-Web/t/01app.t"
> created "MyProj-Web/t/02pod.t"
> created "MyProj-Web/t/03podcoverage.t"
> created "MyProj-Web/root/static/images/catalyst_logo.png"
> created "MyProj-Web/root/static/images/btn_120x50_built.png"
> created "MyProj-Web/root/static/images/btn_120x50_built_shadow.png"
> created "MyProj-Web/root/static/images/btn_120x50_powered.png"
> created "MyProj-Web/root/static/images/btn_120x50_powered_shadow.png"
> created "MyProj-Web/root/static/images/btn_88x31_built.png"
> created "MyProj-Web/root/static/images/btn_88x31_built_shadow.png"
> created "MyProj-Web/root/static/images/btn_88x31_powered.png"
> created "MyProj-Web/root/static/images/btn_88x31_powered_shadow.png"
> created "MyProj-Web/root/favicon.ico"
> created "MyProj-Web/Makefile.PL"
> created "MyProj-Web/script/myproj_web_cgi.pl"
> created "MyProj-Web/script/myproj_web_fastcgi.pl"
> created "MyProj-Web/script/myproj_web_server.pl"
> created "MyProj-Web/script/myproj_web_test.pl"
> created "MyProj-Web/script/myproj_web_create.pl"
> [hermida at dla2 ~]$ ll MyProj-Web/
> total 32
> -rw-rw-r-- 1 hermida hermida 150 Dec 13 10:44 Changes
> drwxrwxr-x 3 hermida hermida 4096 Dec 13 10:44 lib
> -rw-rw-r-- 1 hermida hermida 462 Dec 13 10:44 Makefile.PL
> -rw-rw-r-- 1 hermida hermida 22 Dec 13 10:44 myproj_web.yml
> -rw-rw-r-- 1 hermida hermida 57 Dec 13 10:44 README
> drwxrwxr-x 3 hermida hermida 4096 Dec 13 10:44 root
> drwxrwxr-x 2 hermida hermida 4096 Dec 13 10:44 script
> drwxrwxr-x 2 hermida hermida 4096 Dec 13 10:44 t
> [hermida at dla2 ~]$
>
> As mentioned this will be a larger project where only a part of it is
> the web application but all the code will need to share libraries.
> Where will I put all of the directories, code and other files that are
> not related at all to the web application but will need to use
> libraries
> in lib? It doesn't seem to make sense to have it right in the web
> application folder. This is why I made a master MyProj folder,
> renamed
> MyProj-Web to "web" and put it inside of MyProj. Then there can be a
> nice separation of components and the project can grow.
It's a question of how you look at it -
You're asking why the rest of the app should be in the web
application directory
I'm asking why the web part can't be in the main app directory :)
--
Matt S Trout, Technical Director, Shadowcat Systems Ltd.
Offering custom development, consultancy and support contracts for
Catalyst,
DBIx::Class and BAST. Contact mst (at) shadowcatsystems.co.uk for
details.
+ Help us build a better perl ORM: http://dbix-
class.shadowcatsystems.co.uk/ +
More information about the Catalyst
mailing list