[Catalyst] Argh! Trying to upgrade Catalyst -- getting "Can't use string as a HASH ref..."

Tomas Doran bobtfish at bobtfish.net
Sat Mar 30 23:55:08 GMT 2013


What's the backtrace look like if you load Devel::SimpleTrace or Carp::Always?

Cheers
t0m

On 30 Mar 2013, at 12:04, will trillich <will.trillich at serensoft.com> wrote:

> We have a Catalyst app "Waste::Web" that has been running fine and we are trying to upgrade to a more modern set of libraries via "cpanm". (One library was upgraded that caused conflicts, now we're running a sweep to get everything updated...)
> 
> We have an old app called "Spills" that still runs fine. The problem is with a different old app called "Waste::Web"... It won't start, throwing the "can't use string as HASH ref" error, neither as standalone server for testing nor via apache. Suggestions?
> 
> 
> 
> At first we thought maybe the script formats had changed. So we ran a quick sample "catalyst.pl Catalyst::Upgrade" to come up with the latest structure for comparison. This I'll call "new script" below. Then we looked at the script/*pl files, the lib/* files. None of the structures seem to have changed from what we can tell.
> 
> That is, the old script/*server.pl script has the same standard structure as the brand new script:
> 
> #!/usr/bin/env perl
> BEGIN {
>    $ENV{CATALYST_SCRIPT_GEN} = 40;
> }
> use Catalyst::ScriptRunner;
> Catalyst::ScriptRunner->run('Waste::Web', 'Server');
> 1;
> 
> Comparing lib/Waste/Web.pm (old script) to lib/Catalyst/Upgrade.pm (new script) also looks similar -- commented code redacted for space:
> 
> package Waste::Web;
> use Moose;
> use namespace::autoclean;
> 
> use Catalyst::Runtime 5.80;
> 
> use Catalyst qw/
>    ConfigLoader
>    Static::Simple
>        Session
>        Session::Store::DBIC
>        Session::State::Cookie
>        Authentication
>        Authentication::Credential::Password
>        Authorization::Roles
>    Cache
> /;
> use Waste::Lib::CSV;
> 
> extends 'Catalyst';
> 
> our $VERSION = '1.10';
> 
> __PACKAGE__->config(
>    name => 'Waste::Web',
>    # Disable deprecated behavior needed by old applications
>    disable_component_resolution_regex_fallback => 1,
> );
> 
> # Start the application
> __PACKAGE__->setup();
> 
> In the new script there *is* a new option to the __PACKAGE__->config call but it's just to instantiate the X-Catalyst http header. All serious structures look the same.
> 
> But Catalyst::Upgrade runs just fine, and an old app Spill runs just fine, where Waste::Web throws the error:
> 
> Waste$ perl script/waste_web_server.pl 
> Can't use string ("Waste::Web") as a HASH ref while "strict refs" in use at /usr/share/perl5/Class/Accessor/Fast.pm line 10.
> Compilation failed in require at /usr/local/share/perl/5.10.1/Catalyst/ScriptRunner.pm line 50.
> 
> Waste$ cd ../Catalyst-Upgrade/
> Catalyst-Upgrade$ perl script/catalyst_upgrade_server.pl 
> HTTP::Server::PSGI: Accepting connections at http://0:3000/
> 
> Any ideas why we'd be getting this error?
> 
> Here's the single-step debug log:
> 
> Catalyst::Script::Server::run(/usr/local/share/perl/5.10.1/Catalyst/Script/Server.pm:240):
> DB<1> v
> 237             $self->pidfile->write
> 238:                if $self->_has_pidfile;
> 239     
> 240==>          $self->_run_application;
> 241         }
> 242     
> 243     
> 244     }
> 245     
> 246     sub _plack_loader_args {
> 
> DB<1> s
> Catalyst::ScriptRole::_run_application(/usr/local/share/perl/5.10.1/Catalyst/ScriptRole.pm:88):
> 88:         my $self = shift;
> 
> DB<1> n
> Catalyst::ScriptRole::_run_application(/usr/local/share/perl/5.10.1/Catalyst/ScriptRole.pm:89):
> 89:         my $app = $self->application_name;
> 
> DB<1> n
> Catalyst::ScriptRole::_run_application(/usr/local/share/perl/5.10.1/Catalyst/ScriptRole.pm:90):
> 90:         Class::MOP::load_class($app);
> 
> DB<1> p $app
> Waste::Web
> 
> DB<2> n
> Can't use string ("Waste::Web") as a HASH ref while "strict refs" in use at /usr/share/perl5/Class/Accessor/Fast.pm line 10.
> Compilation failed in require at /usr/local/share/perl/5.10.1/Catalyst/ScriptRunner.pm line 50.
> at /usr/local/share/perl/5.10.1/Catalyst/ScriptRole.pm line 90.
>        Catalyst::ScriptRole::_run_application('Catalyst::Script::Server=HASH(0xa5e1660)') called at /usr/local/share/perl/5.10.1/Catalyst/Script/Server.pm line 240
>        Catalyst::Script::Server::run('Catalyst::Script::Server=HASH(0xa5e1660)') called at /usr/local/share/perl/5.10.1/Catalyst/ScriptRunner.pm line 50
>        Catalyst::ScriptRunner::run('Catalyst::ScriptRunner', 'Waste::Web', 'Server') called at script/waste_web_server.pl line 8
> Debugged program terminated.  Use q to quit or R to restart,
>  use o inhibit_exit to avoid stopping after program termination,
>  h q, h R or h o to get additional info.  
> 
> 
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/




More information about the Catalyst mailing list