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

will trillich will.trillich at serensoft.com
Sat Mar 30 18:06:39 GMT 2013


No output from moose-outdated.

For now it looks like totally disabling the Cache is at least letting the
site/app launch... :)


On Sat, Mar 30, 2013 at 12:53 PM, Dimitar Petrov <mitakaa at gmail.com> wrote:

> Just curiosity, does moose-outdated shows any outdated packages or there
> is no output?
>
>
> On Sat, Mar 30, 2013 at 6:50 PM, will trillich <
> will.trillich at serensoft.com> wrote:
>
>> Still digging deeper -- here's the "T"race for right before it tries to
>> hit the anonymous closure sub inside make_accessor: Comparing this again=
st
>> "Spill" which seems to have no problems at all...
>>
>> package Class::Accessor::Fast;
>> use base 'Class::Accessor';
>> use strict;
>> $Class::Accessor::Fast::VERSION =3D '0.34';
>>
>> sub make_accessor {
>>     my($class, $field) =3D @_;
>>
>>     return sub {
>>         return $_[0]->{$field} if scalar(@_) =3D=3D 1; *# <=3D=3D $_[0] =
is
>> string "Waste::Web" so boom!*
>>         return $_[0]->{$field}  =3D scalar(@_) =3D=3D 2 ? $_[1] : [@_[1.=
.$#_]];
>>     };
>> }
>>
>> $ =3D Catalyst::Plugin::Cache::_default_curried_cache('Waste::Web') call=
ed
>> from file `/usr/share/perl5/Catalyst/Plugin/Cache.pm' line 159
>> $ =3D Catalyst::Plugin::Cache::cache('Waste::Web') called from file
>> `/usr/share/perl5/Catalyst/TraitFor/Model/DBIC/Schema/Caching.pm' line 88
>> . =3D
>> Class::MOP::Class:::before(ref(Moose::Meta::Class::__ANON__::SERIAL::28),
>> 'Waste::Web') called from file
>> `/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm' line 49
>> $ =3D
>> Class::MOP::Method::Wrapped::__ANON__[/usr/local/lib/perl/5.10.1/Class/M=
OP/Method/Wrapped.pm:51](ref(Moose::Meta::Class::__ANON__::SERIAL::28),
>> 'Waste::Web') called from file
>> `/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm' line 91
>> $ =3D
>> Moose::Meta::Class::__ANON__::SERIAL::28::ACCEPT_CONTEXT(ref(Moose::Meta=
::Class::__ANON__::SERIAL::28),
>> 'Waste::Web') called from file `/usr/local/share/perl/5.10.1/Catalyst.pm'
>> line 629
>> $ =3D Catalyst::_filter_component('Waste::Web',
>> ref(Moose::Meta::Class::__ANON__::SERIAL::28)) called from file
>> `/usr/local/share/perl/5.10.1/Catalyst.pm' line 700
>> $ =3D Catalyst::model('Waste::Web', 'Waste') called from file
>> `/usr/share/perl5/Catalyst/Model/DBIC/Schema.pm' line 549
>> $ =3D
>> Catalyst::Model::DBIC::Schema::__ANON__[/usr/share/perl5/Catalyst/Model/=
DBIC/Schema.pm:550]('Waste::Web::Model::Waste::Session',
>> 'Waste::Web', undef) called from file
>> `/usr/local/share/perl/5.10.1/Catalyst.pm' line 629
>> $ =3D Catalyst::_filter_component('Waste::Web',
>> 'Waste::Web::Model::Waste::Session', undef) called from file
>> `/usr/local/share/perl/5.10.1/Catalyst.pm' line 700
>> $ =3D Catalyst::model('Waste::Web', 'Waste::Session', undef) called from
>> file `/usr/share/perl5/Catalyst/Plugin/Session/Store/DBIC.pm' line 145
>> $ =3D
>> Catalyst::Plugin::Session::Store::DBIC::session_store_model('Waste::Web')
>> called from file `/usr/share/perl5/Catalyst/Plugin/Session/Store/DBIC.pm'
>> line 78
>> . =3D Catalyst::Plugin::Session::Store::DBIC::setup_finished('Waste::Web=
',
>> 1) called from file `/usr/local/share/perl/5.10.1/Catalyst.pm' line 1233
>> . =3D Catalyst::setup_finalize('Waste::Web') called from file
>> `/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm' line 50
>> . =3D
>> Class::MOP::Method::Wrapped::__ANON__[/usr/local/lib/perl/5.10.1/Class/M=
OP/Method/Wrapped.pm:51]('Waste::Web')
>> called from file `/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm'
>> line 91
>> . =3D Waste::Web::setup_finalize('Waste::Web') called from file
>> `/usr/local/share/perl/5.10.1/Catalyst.pm' line 1207
>> . =3D Catalyst::setup('Waste::Web') called from file
>> `/home/will/projects/perl-mvc/Waste/script/../lib/Waste/Web.pm' line 54
>> $ =3D require 'Waste/Web.pm' called from file
>> `/usr/local/share/perl/5.10.1/Module/Runtime.pm' line 317
>> . =3D Module::Runtime::require_module('Waste::Web') called from file
>> `/usr/local/share/perl/5.10.1/Class/Load.pm' line 177
>> @ =3D
>> Class::Load::__ANON__[/usr/local/share/perl/5.10.1/Class/Load.pm:180]()
>> called from file `/usr/local/share/perl/5.10.1/Try/Tiny.pm' line 72
>> $ =3D eval {...} called from file
>> `/usr/local/share/perl/5.10.1/Try/Tiny.pm' line 67
>> @ =3D Try::Tiny::try(ref(CODE), ref(Try::Tiny::Catch)) called from file
>> `/usr/local/share/perl/5.10.1/Class/Load.pm' line 183
>> @ =3D Class::Load::try_load_class('Waste::Web', undef) called from file
>> `/usr/local/share/perl/5.10.1/Class/Load.pm' line 38
>> . =3D Class::Load::load_class('Waste::Web') called from file
>> `/usr/local/share/perl/5.10.1/Catalyst/ScriptRole.pm' line 90
>> . =3D Catalyst::ScriptRole::_run_application(ref(Catalyst::Script::Serve=
r))
>> called from file `/usr/local/share/perl/5.10.1/Catalyst/Script/Server.pm'
>> line 240
>> . =3D Catalyst::Script::Server::run(ref(Catalyst::Script::Server)) called
>> from file `/usr/local/share/perl/5.10.1/Catalyst/ScriptRunner.pm' line 50
>>
>>
>>
>> On Sat, Mar 30, 2013 at 11:53 AM, will trillich <
>> will.trillich at serensoft.com> wrote:
>>
>>> Looks like it bombs out at $c->session_store_model because "$c" is just
>>> "Waste::Web" and strict refs is in use. But why wouldn't it bomb out for
>>> Catalyst::Upgrade or Spill?
>>>
>>>
>>>
>>> Catalyst::Plugin::Session::Store::DBIC::setup_finished(/usr/share/perl5=
/Catalyst/Plugin/Session/Store/DBIC.pm:76):
>>> DB<23> *v 70*
>>> 69      sub setup_finished {
>>> 70:         my $c =3D shift;
>>> 71
>>> 72:         return $c->next::method unless @_;
>>> 73
>>> 74          # Try to determine id_field if it isn't set
>>> 75:         unless ($c->_session_plugin_config->{id_field}) {
>>> 76=3D=3D>           my $model =3D $c->session_store_model;
>>>
>>> DB<24> *p $c->session_store_model*
>>> 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.
>>>
>>>
>>> On Sat, Mar 30, 2013 at 11:04 AM, 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, throwi=
ng
>>>> 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. Th=
en 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} =3D 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 =3D '1.10';
>>>>
>>>> __PACKAGE__->config(
>>>>     name =3D> 'Waste::Web',
>>>>     # Disable deprecated behavior needed by old applications
>>>>     disable_component_resolution_regex_fallback =3D> 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 seri=
ous
>>>> 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/Sc=
ript/Server.pm:240):
>>>> DB<1> *v*
>>>> 237             $self->pidfile->write
>>>> 238:                if $self->_has_pidfile;
>>>> 239
>>>> 240=3D=3D>          $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/Ca=
talyst/ScriptRole.pm:88):
>>>> 88:         my $self =3D shift;
>>>>
>>>> DB<1> *n*
>>>>
>>>> Catalyst::ScriptRole::_run_application(/usr/local/share/perl/5.10.1/Ca=
talyst/ScriptRole.pm:89):
>>>> 89:         my $app =3D $self->application_name;
>>>>
>>>> DB<1> *n*
>>>>
>>>> Catalyst::ScriptRole::_run_application(/usr/local/share/perl/5.10.1/Ca=
talyst/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=3DHAS=
H(0xa5e1660)')
>>>> called at /usr/local/share/perl/5.10.1/Catalyst/Script/Server.pm line =
240
>>>>
>>>> Catalyst::Script::Server::run('Catalyst::Script::Server=3DHASH(0xa5e16=
60)')
>>>> 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.
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>>  Will Trillich :: 812.454.6431
>>>
>>> =93Grading takes away all the fun from failing. And a huge part of
>>> education is about failure.=94  -- Shimon Schocken
>>>
>>
>>
>>
>> --
>>  Will Trillich :: 812.454.6431
>>
>> =93Grading takes away all the fun from failing. And a huge part of
>> education is about failure.=94  -- Shimon Schocken
>>
>> _______________________________________________
>> 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/
>>
>>
>
> _______________________________________________
> 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/
>
>


-- =

 Will Trillich :: 812.454.6431

=93Grading takes away all the fun from failing. And a huge part of education
is about failure.=94  -- Shimon Schocken
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20130330/9273e=
fed/attachment.htm


More information about the Catalyst mailing list