Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9268995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:59:52+00:00 2026-06-18T14:59:52+00:00

When using catalyst is there a way to specify a dev, test and production

  • 0

When using catalyst is there a way to specify a dev, test and production database like you would in Rails? I have looked through the documentation but I haven’t found an answer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T14:59:53+00:00Added an answer on June 18, 2026 at 2:59 pm

    With reference from cpan Catalyst Testing Tutorial

    You may wish to maintain both a “production database” for your live application and a
    “testing database” for your test cases.

    DATABASE CONFIG SWITCHING IN YOUR MODEL CLASS

    One solution is to allow the database specification to be overridden with an environment variable. For example, open lib/MyApp/Model/MyAppDB.pm in your editor and change the
    __PACKAGE__->config(... declaration to resemble:

    my $dsn = $ENV{MYAPP_DSN} ||= 'dbi:SQLite:myapp.db';
    __PACKAGE__->config(
        schema_class => 'MyAppDB',
        connect_info => [
            $dsn,
            '',
            '',
            { AutoCommit => 1 },
    
        ],
    );
    

    Then, when you run your test case, you can use commands such as:

    $ cp myapp.db myappTEST.db
    $ CATALYST_DEBUG=0
    MYAPP_DSN=”dbi:SQLite:myappTEST.db” prove –lib lib -v t/live_app01.t

    This will modify the DSN only while the test case is running. If you
    launch your normal application without the MYAPP_DSN environment
    variable defined, it will default to the same dbi:SQLite:myapp.db as
    before.

    DATABASE CONFIG SWITCHING USING MULTIPLE CONFIG FILES

    By utilizing Catalyst::Plugin::ConfigLoaders functionality for loading
    multiple config files based on environment variables you can override
    your default (production) database connection settings.

    Setting $ENV{ MYAPP_CONFIG_LOCAL_SUFFIX } to ‘testing’ in your test
    script results in loading of an additional config file named
    myapp_testing.conf after myapp.conf which will override any parameters
    in myapp.conf.

    You should set the environment variable in the BEGIN block of your
    test script to make sure it’s set before your Catalyst application is
    started.

    The following is an example for a config and test script for a
    DBIx::Class model named MyDB and a controller named Foo:

    myapp_testing.conf:

    <Model::MyDB>
        <connect_info>
            dsn dbi:SQLite:myapp.db
        </connect_info>
    </Model::MyDB>
    

    Also check this when using seperate databases

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the Assets plugin in my Catalyst app, and I would like some
In Catalyst is there a way to specify that the sub accepts 0-n arguments,
I'm using Catalyst with Template::Toolkit as my templating system. I would like to be
I have created one Catalyst application and I have created Schema and Model using
I'm using HTML::FormHandler with Catalyst and I have this field: has_field 'client_account_id' => (
I am using Catalyst Perl MVC framework with HTML::FormHandler as forms processor. Are there
i have installed all my dependencies for Catalyst in ~/perl5/lib/perl5 using local::lib I want
I'm using Catalyst for my Perl web app. What is the accepted way of
I'm writing a web application using the Catalyst framework . I'm also using a
Using SQL Server 2008 R2 we are looking for a way to select the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.