FAQ
If this is the wrong list, please direct me to the right place. I'm trying
to get Catalyst working under apache/mod_perl (works fine with the
standalone server).

Basically, I have a very simple app called Registration. In apache I set it
up like:

<Location /registration>
SetHandler perl-script
PerlHandler Registration
</Location>

If I startup apache through the init.d script, it complains that it cant
find Registration.pm in @INC. The obvious way around this was to set the
PERL5LIB env var to the path of my app lib dir, and so this does work:

PERL5LIB=/var/www/registration/lib /usr/sbin/apache2ctl start

However, I need a way to set this way so it "sticks" on reboot, ideally so I
can simply start apache through the /etc/init.d script. I suppose I could
edit that script directly, but I'd rather not (and assume there is a simpler
way)

I've tried setting the variable in the apache conf, but this doesn't seem to
work:
PerlSetEnv PERL5LIB /var/www/registration/lib

Any ideas here on what i'm missing?


Second question. I am using the FormValidator::Simple plugin. In my
lib/Registration.pm file, I set it up like this (per the documentation):

__PACKAGE__->config(
validator => {
messages => 'messages.yml'
}
}

Now when I startup apache (the one way I can get it to work) and hit my URL,
I get the error:
failed to resolve handler `Registration': set hash reference or YAML file
path. at /usr/local/share/perl/5.8.8/FormValidator/Simple/Messages.pm line
43\nCompilation failed in require at (eval 2) line 3.

When I give the absolute path to messages.yml in the config above, the error
resolves, however I dont want to set an absolute path here for obvious
reasons. What are my options ?


Thanks !
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070514/06b56aa5/attachment.htm

Search Discussions

  • Andy Grundman at May 14, 2007 at 10:24 pm

    On May 14, 2007, at 5:09 PM, John Goulah wrote:

    If this is the wrong list, please direct me to the right place.
    I'm trying to get Catalyst working under apache/mod_perl (works
    fine with the standalone server).

    Basically, I have a very simple app called Registration. In apache
    I set it up like:

    <Location /registration>
    SetHandler perl-script
    PerlHandler Registration
    </Location>

    If I startup apache through the init.d script, it complains that it
    cant find Registration.pm in @INC. The obvious way around this was
    to set the PERL5LIB env var to the path of my app lib dir, and so
    this does work:

    PERL5LIB=/var/www/registration/lib /usr/sbin/apache2ctl start
    Please see the example configurations:

    1.3:
    http://search.cpan.org/~agrundma/Catalyst-Engine-Apache-1.09/lib/
    Catalyst/Engine/Apache/MP13.pm

    2.x:
    http://search.cpan.org/~agrundma/Catalyst-Engine-Apache-1.09/lib/
    Catalyst/Engine/Apache2/MP20.pm
  • John Goulah at May 14, 2007 at 11:03 pm
    Thanks, I'm using apache 2.2.3 -- That setup does sound much more logical,
    and here is what I have to match the example:

    -----
    PerlSwitches -I/var/www/registration/lib

    PerlModule Registration

    <VirtualHost *>
    ServerName myhostname
    DocumentRoot /var/www/registration/root

    <Location />
    SetHandler modperl
    PerlResponseHandler Registration
    </Location>
    </VirtualHost>
    -----

    When I start apache, I see everything loading (plugins, classes, private
    actions, paths) and then:

    [info] Registration powered by Catalyst 5.7007
    fork: Cannot allocate memory
    unable to fork new process



    What am I doing wrong?

    Thanks!
    John


    On 5/14/07, Andy Grundman wrote:

    On May 14, 2007, at 5:09 PM, John Goulah wrote:

    If this is the wrong list, please direct me to the right place.
    I'm trying to get Catalyst working under apache/mod_perl (works
    fine with the standalone server).

    Basically, I have a very simple app called Registration. In apache
    I set it up like:

    <Location /registration>
    SetHandler perl-script
    PerlHandler Registration
    </Location>

    If I startup apache through the init.d script, it complains that it
    cant find Registration.pm in @INC. The obvious way around this was
    to set the PERL5LIB env var to the path of my app lib dir, and so
    this does work:

    PERL5LIB=/var/www/registration/lib /usr/sbin/apache2ctl start
    Please see the example configurations:

    1.3:
    http://search.cpan.org/~agrundma/Catalyst-Engine-Apache-1.09/lib/<http://search.cpan.org/%7Eagrundma/Catalyst-Engine-Apache-1.09/lib/>
    Catalyst/Engine/Apache/MP13.pm

    2.x:
    http://search.cpan.org/~agrundma/Catalyst-Engine-Apache-1.09/lib/<http://search.cpan.org/%7Eagrundma/Catalyst-Engine-Apache-1.09/lib/>
    Catalyst/Engine/Apache2/MP20.pm

    _______________________________________________
    List: [email protected]
    Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/[email protected]/
    Dev site: http://dev.catalyst.perl.org/
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070514/b32eedc1/attachment.htm
  • Carl Johnstone at May 15, 2007 at 11:45 am

    [info] Registration powered by Catalyst 5.7007
    fork: Cannot allocate memory
    unable to fork new process
    You've ran out of memory!

    Might be worth watching top/task manager in another window whilst you try to
    startup to see what's going on memory wise.

    Carl
  • John Goulah at May 15, 2007 at 4:03 pm
    Thats odd, since I have 256MB of memory (not a ton, but should be enough).
    On other box with a slightly older version of apache (2.0.55) it works fine,
    except my second question was never answered-- I still need a full path in
    the validator config settings. Maybe I can define some path in my default
    yaml file and use that? Or better yet, is there a way to dynamically get
    the path?

    Thanks,
    John
    On 5/15/07, Carl Johnstone wrote:

    [info] Registration powered by Catalyst 5.7007
    fork: Cannot allocate memory
    unable to fork new process
    You've ran out of memory!

    Might be worth watching top/task manager in another window whilst you try
    to
    startup to see what's going on memory wise.

    Carl


    _______________________________________________
    List: [email protected]
    Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/[email protected]/
    Dev site: http://dev.catalyst.perl.org/
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070515/5ac69c52/attachment.htm
  • Wade Stuart at May 15, 2007 at 4:19 pm

    "John Goulah" <[email protected]> wrote on 05/15/2007 10:03:59 AM:

    Thats odd, since I have 256MB of memory (not a ton, but should be
    enough). On other box with a slightly older version of apache (2.0.
    55) it works fine, except my second question was never answered-- I
    still need a full path in the validator config settings. Maybe I
    can define some path in my default yaml file and use that? Or
    better yet, is there a way to dynamically get the path?

    Thanks,
    John
    Well, 256 mb of ram in total? I assume linux or bsd? You are talking
    memory starvation and swap hell just from loading the OS, generic daemons
    and things like fs cache (in any modern distro not pruned down to hell).
    Add apache and mod_perl to that equation and you will find yourself licking
    the bucket soon enough.

    -Wade
    On 5/15/07, Carl Johnstone wrote:
    [info] Registration powered by Catalyst 5.7007
    fork: Cannot allocate memory
    unable to fork new process
    You've ran out of memory!

    Might be worth watching top/task manager in another window whilst you try to
    startup to see what's going on memory wise.

    Carl


    _______________________________________________
    List: [email protected]
    Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/[email protected]/
    Dev site: http://dev.catalyst.perl.org/
    _______________________________________________
    List: [email protected]
    Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/[email protected]/
    Dev site: http://dev.catalyst.perl.org/
  • John Goulah at May 15, 2007 at 4:30 pm
    Its linux, and yeah I know its not much for a production box, these are
    basically standalone machines (laptops) to take to events that one person at
    a time would use to sign up through a web form. I would assume 256 MB is
    enough to start apache. I assume mod_perl has been tested and runs fine
    under apache 2.2.x and that is indeed not the problem, but I'd have to have
    someone verify that.

    Thanks again,
    John
    On 5/15/07, [email protected] wrote:






    "John Goulah" <[email protected]> wrote on 05/15/2007 10:03:59 AM:
    Thats odd, since I have 256MB of memory (not a ton, but should be
    enough). On other box with a slightly older version of apache (2.0.
    55) it works fine, except my second question was never answered-- I
    still need a full path in the validator config settings. Maybe I
    can define some path in my default yaml file and use that? Or
    better yet, is there a way to dynamically get the path?

    Thanks,
    John
    Well, 256 mb of ram in total? I assume linux or bsd? You are talking
    memory starvation and swap hell just from loading the OS, generic daemons
    and things like fs cache (in any modern distro not pruned down to hell).
    Add apache and mod_perl to that equation and you will find yourself
    licking
    the bucket soon enough.

    -Wade
    On 5/15/07, Carl Johnstone wrote:
    [info] Registration powered by Catalyst 5.7007
    fork: Cannot allocate memory
    unable to fork new process
    You've ran out of memory!

    Might be worth watching top/task manager in another window whilst you
    try
    to
    startup to see what's going on memory wise.

    Carl


    _______________________________________________
    List: [email protected]
    Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/[email protected]/
    Dev site: http://dev.catalyst.perl.org/
    _______________________________________________
    List: [email protected]
    Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/[email protected]/
    Dev site: http://dev.catalyst.perl.org/

    _______________________________________________
    List: [email protected]
    Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/[email protected]/
    Dev site: http://dev.catalyst.perl.org/
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070515/38151985/attachment.htm
  • Perrin Harkins at May 15, 2007 at 4:55 pm

    On 5/15/07, John Goulah wrote:
    I would assume 256 MB is enough to start apache.
    It is. Apache's memory requirements are pretty light and mod_perl
    doesn't have much overhead either. It's really the perl interpreter
    and the code you're loading that matters, as well as whatever else is
    on that box that would use up memory.

    A good tool for checking this on Linux is /usr/bin/free.
    I assume mod_perl has been tested and runs fine
    under apache 2.2.x
    It does, although the APIs for the new auth features are not all
    available from perl yet.

    - Perrin
  • Matt S Trout at May 15, 2007 at 4:40 pm

    On Tue, May 15, 2007 at 11:03:59AM -0400, John Goulah wrote:
    Thats odd, since I have 256MB of memory (not a ton, but should be enough).
    On other box with a slightly older version of apache (2.0.55) it works fine,
    except my second question was never answered-- I still need a full path in
    the validator config settings. Maybe I can define some path in my default
    yaml file and use that? Or better yet, is there a way to dynamically get
    the path?
    ConfigLoader handles this.

    Search the docs for path_to :)

    --
    Matt S Trout Need help with your Catalyst or DBIx::Class project?
    Technical Director Want a managed development or deployment platform?
    Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote
    http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/
  • John Goulah at May 15, 2007 at 4:43 pm
    Following up, I dropped another 256 MB chip in there and apache started up
    ok. Guess I was wrong :-)

    Matt, thanks for the advice on ConfigLoader, much appreciated-

    Thanks!
    John
    On 5/15/07, Matt S Trout wrote:
    On Tue, May 15, 2007 at 11:03:59AM -0400, John Goulah wrote:
    Thats odd, since I have 256MB of memory (not a ton, but should be enough).
    On other box with a slightly older version of apache (2.0.55) it works fine,
    except my second question was never answered-- I still need a full path in
    the validator config settings. Maybe I can define some path in my default
    yaml file and use that? Or better yet, is there a way to dynamically get
    the path?
    ConfigLoader handles this.

    Search the docs for path_to :)

    --
    Matt S Trout Need help with your Catalyst or DBIx::Class
    project?
    Technical Director Want a managed development or deployment
    platform?
    Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a
    quote
    http://chainsawblues.vox.com/
    http://www.shadowcatsystems.co.uk/

    _______________________________________________
    List: [email protected]
    Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/[email protected]/
    Dev site: http://dev.catalyst.perl.org/
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070515/e8c00f8a/attachment.htm
  • John Goulah at May 15, 2007 at 6:22 pm
    Sorry for the ignorance, but the docs are somewhat lacking good examples.
    It doesn't seem I can use the $c object in the main app file
    (lib/Appname.pm). I've tried stuff like __path_to_(myconfig.yml)__ and that
    throws compile errors. So how would I change this statement to do what I
    need:

    __PACKAGE__->config(
    name => 'Registration',

    validator => {
    messages => "messages.yml",
    },
    );


    Thanks,
    John

    On 5/15/07, Matt S Trout wrote:
    On Tue, May 15, 2007 at 11:03:59AM -0400, John Goulah wrote:
    Thats odd, since I have 256MB of memory (not a ton, but should be enough).
    On other box with a slightly older version of apache (2.0.55) it works fine,
    except my second question was never answered-- I still need a full path in
    the validator config settings. Maybe I can define some path in my default
    yaml file and use that? Or better yet, is there a way to dynamically get
    the path?
    ConfigLoader handles this.

    Search the docs for path_to :)

    --
    Matt S Trout Need help with your Catalyst or DBIx::Class
    project?
    Technical Director Want a managed development or deployment
    platform?
    Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a
    quote
    http://chainsawblues.vox.com/
    http://www.shadowcatsystems.co.uk/

    _______________________________________________
    List: [email protected]
    Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/[email protected]/
    Dev site: http://dev.catalyst.perl.org/
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070515/f30e45fd/attachment.htm
  • Matt S Trout at May 15, 2007 at 8:17 pm

    On Tue, May 15, 2007 at 01:22:25PM -0400, John Goulah wrote:
    Sorry for the ignorance, but the docs are somewhat lacking good examples.
    It doesn't seem I can use the $c object in the main app file
    (lib/Appname.pm). I've tried stuff like __path_to_(myconfig.yml)__ and that
    throws compile errors. So how would I change this statement to do what I
    need:

    __PACKAGE__->config(
    name => 'Registration',

    validator => {
    messages => "messages.yml",
    },
    );
    cat - >registration.conf
    name Registration

    <validator>
    messages __path_to(messages.yml)__
    </validator>
    ^D

    or similar for YAML, but I think in apache-style due to too much web dev :)

    (ConfigLoader will find registration.conf for you)

    --
    Matt S Trout Need help with your Catalyst or DBIx::Class project?
    Technical Director Want a managed development or deployment platform?
    Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote
    http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedMay 14, '07 at 10:09p
activeMay 15, '07 at 8:17p
posts12
users6
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2023 Grokbase