[Catalyst] How to configure Catalyst home directory

John Beppu john.beppu at gmail.com
Sat Dec 16 06:45:34 GMT 2006


I don't have much experience with the -Home directive, but I do know some
ways to configure Catalyst so that you can put your files wherever you want.

There are 3 types of files that we care about:

   - Configuration
   - Templates
   - Perl Modules

Configuration:

Suppose you created a Catalyst application called Example via `catalyst.pl
Example`.

cd Example
perl script/example_server.pl

http://localhost:3000/?dump_info=3D1 -- Scroll down to where the "Config"
header is and pay attention to what it looks like.

Now, inside the Example/ directory, there should be a file named example.yml
.
Let's edit example.yml so that we can be sure that Catalyst is using our
config file rather than its defaults.

example.yml
---
name: Example
message: Hello, World!

Next, we're going to move example.yml and tell Catalyst where to find it
using $ENV{EXAMPLE_CONFIG}.

mv example.yml /tmp
export EXAMPLE_CONFIG=3D/tmp

This tells Catalyst that the config files for the Example Catalyst
application can be found in /tmp.

^C
perl script/example_server.pl

http://localhost:3000/?dump_info=3D1 -- Scroll down to where the "Config"
header and notice how it has `message =3D> "Hello, World!".

Templates:

If you want to change the location of your templates, you can specify a
directory in the "root" key of example.yml.  For example:

---
name: Example
message: Hello, World!
root: /tmp/Example/root

Perl Modules:

If you want to put your Perl modules in a non-standard location, you can set
$ENV{PERL5LIB} to tell perl where to look.

export PERL5LIB=3D"/tmp/lib"



These 3 configuration points will allow you to to put your Catalyst files
wherever you want on your filesystem.




On 12/13/06, N. Arakawa <n-a at u01.gate01.com> wrote:
>
> I want to configure Catalyst home directory.
> I use up-to-date  Catalyst in CPAN.
>
> Manual suggests to use
>     use Catalyst qw[-Home=3D/usr/mst];
> but doesn't work.
>
> Moreover I can't even find the code segment which will handle '-Home'
> flag.
>
> So now I do something like:
>   BEGIN{
>      $ENV{CATALYST_HOME}=3D'/usr/mnt';
>   }
>
> Is it a bug of Catalyst or me?
>
>
> B.T.W
> Currently, config file path are resolved based on 'OS current
> directory',  not a 'Catalyst home directory.'
>
>         __PACKAGE__->config(
>                      file =3D> 'config.yml',
>                    );
>
> I hope this behavior changes.
> Another possibility can be to allow "__HOME__/config.yml" syntax at here.
>
> Thanks!
>
> --
> - N. Arakawa
>
>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20061215/0c6df=
3bd/attachment-0001.htm


More information about the Catalyst mailing list