Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi all!

I've been working on getting my Windows machine up and running with Strawberry Perl and Catalyst for development purposes. CPAN seemed to pull down everything but I'm running into a problem with a simple tutorial app.

I started a cmd shell using the Perl command-line shortcut provided by Strawberry.

I ran: catalyst Hello to create a basic, empty application. I change into the Hello directory and run: perl script/hello_server.pl -r

and I get:
Couldn't load class (Hello) because: Can't use an undefined value as a HASH reference at C:/strawberry/perl/site/lib/Catalyst.pm line 2697.
BEGIN failed--compilation aborted at C:\work\Hello\lib/Hello.pm line 19.
Compilation failed in require at C:/strawberry/perl/site/lib/Class/MOP.pm line 1
14.
 at C:/strawberry/perl/site/lib/Class/MOP.pm line 120
        Class::MOP::__ANON__('Can\'t use an undefined value as a HASH reference
at C:/straw...') called at C:/strawberry/perl/site/lib/Try/Tiny.pm line 100
        Try::Tiny::try('CODE(0x1281c24)', 'Try::Tiny::Catch=REF(0x13bac14)') cal
led at C:/strawberry/perl/site/lib/Class/MOP.pm line 125
        Class::MOP::load_first_existing_class('Hello') called at C:/strawberry/p
erl/site/lib/Class/MOP.pm line 137
        Class::MOP::load_class('Hello') called at C:/strawberry/perl/site/lib/Ca
talyst/ScriptRole.pm line 48
        Catalyst::ScriptRole::_run_application('Catalyst::Script::Server=HASH(0x
13bd5c4)') called at C:/strawberry/perl/site/lib/Catalyst/Script/Server.pm line
179
        Catalyst::Script::Server::run('Catalyst::Script::Server=HASH(0x13bd5c4)'
) called at C:/strawberry/perl/site/lib/Catalyst/ScriptRunner.pm line 20
        Catalyst::ScriptRunner::run('Catalyst::ScriptRunner', 'Hello', 'Server')
 called at script/hello_server.pl line 8

I haven't changed or added anything yet. I have another system I can use, but it would be much more convenient to use my laptop to work. Has anyone run into this? I've done the usual Google without much success.

Thanks!

  • Comment on Getting Started with Catalyst and Strawberry Perl

Replies are listed 'Best First'.
Re: Getting Started with Catalyst and Strawberry Perl
by jwilkicki (Initiate) on Jan 05, 2011 at 22:55 UTC
    Actually, it looks like a bug in the version of Catalyst I downloaded from CPAN. I just updated the module and now the development server is behaving itself. Thanks for the suggestions.
      In the absence of anything better, start by looking at the lines referenced in the error messages. Somewhere in there you should find a clue as to what's missing.

      Not sure whether you should start at the top and work your way down, or go from the bottom up.

      Ultimately, the problem is that line 2697 of Catalyst.pm was expecting a hash reference, but got passed undef. It looks like this is probably a flow-on from the same thing having happened at line 120 of MOP.pm.

      Also check this google link to see if any of the hits there offer anything useful.

      Cheers,
      Rob