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

will trillich will.trillich at serensoft.com
Sun Mar 31 06:21:50 GMT 2013


$ *perl -wMDevel::SimpleTrace script/waste_web_server.pl *
Duplicate specification "host|h=3Ds" for option "h"
        at Catalyst::ScriptRole::_getopt_spec_warnings(unknown source)
        at
MooseX::Getopt::Basic::_parse_argv(/usr/local/share/perl/5.10.1/MooseX/Geto=
pt/Basic.pm:138)
        at
MooseX::Getopt::Basic::process_argv(/usr/local/share/perl/5.10.1/MooseX/Get=
opt/Basic.pm:79)
        at
MooseX::Getopt::Basic::new_with_options(/usr/local/share/perl/5.10.1/MooseX=
/Getopt/Basic.pm:105)
        at
Catalyst::ScriptRunner::run(/usr/local/share/perl/5.10.1/Catalyst/ScriptRun=
ner.pm:50)
        at main::(script/waste_web_server.pl:8)
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
Carp::croak(/usr/local/share/perl/5.10.1/Catalyst/ScriptRunner.pm:50)
        at
Class::Load::_croak(/usr/local/share/perl/5.10.1/Class/Load.pm:200)
        at
Class::Load::load_class(/usr/local/share/perl/5.10.1/Class/Load.pm:41)
        at
Catalyst::ScriptRole::_run_application(/usr/local/share/perl/5.10.1/Catalys=
t/ScriptRole.pm:90)
        at
Catalyst::Script::Server::run(/usr/local/share/perl/5.10.1/Catalyst/Script/=
Server.pm:240)
        at
Catalyst::ScriptRunner::run(/usr/local/share/perl/5.10.1/Catalyst/ScriptRun=
ner.pm:50)
        at main::(script/waste_web_server.pl:8)

So maybe there's something pertinent going on at Catalyst::ScriptRole?
(Doubtful, but just in case...)

MooseX::Getopt::Basic::CODE(0x943d320)(/usr/local/share/perl/5.10.1/MooseX/=
Getopt/Basic.pm:134):

DB<3> *v*
131         my ( $parsed_options, $usage ) =3D try {
132:b           local $SIG{__WARN__} =3D sub { push @warnings, @_ };
133
134=3D=3D>          return $class->_getopt_get_options(\%params, $opt_spec);
135         }
136         catch {
137:            $class->_getopt_spec_exception(\@warnings, $_);
138:        };
139
140:        $class->_getopt_spec_warnings(@warnings) if @warnings;

DB<4> *x $opt_spec*
0  ARRAY(0x9897f38)
   0  ARRAY(0x943cfe0)
      0  'loader_class=3Ds'
      1  'The class to use to detect and load the PSGI engine'
      2  HASH(0x942e650)
           empty hash
   1  ARRAY(0x9438a18)
      0  'help|usage|?|h!'
      1  'Prints this usage information.'
      2  HASH(0x94389e8)
           empty hash
   2  ARRAY(0x9438688)
      0  'debug|d!'
      1  'Force debug mode'
      2  HASH(0x9441648)
           empty hash
   3  ARRAY(0x943dcf0)
      0  'host|h=3Ds'
      1  'Specify a hostname or IP on this host for the server to bind to'
      2  HASH(0x942e850)
           empty hash
   4  ARRAY(0x943d420)
      0  'fork|f!'
      1  'Fork the server to be able to serve multiple requests at once'
      2  HASH(0x943d4b0)
           empty hash
   5  ARRAY(0x943d4d0)
      0  'port|p=3Di'
      1  'Specify a different listening port (to the default port 3000)'
      2  HASH(0x943d4f0)
           empty hash
   6  ARRAY(0x9a03f38)
      0  'pidfile|pid=3Ds'
      1  'Specify a pidfile'
      2  HASH(0x99f8690)
           empty hash
   7  ARRAY(0x99dde10)
      0  'keepalive|k!'
      1  'Support keepalive'
      2  HASH(0x99fdf58)
           empty hash
   8  ARRAY(0x99fe838)
      0  'background|bg!'
      1  'Run in the background'
      2  HASH(0x99f0498)
           empty hash
   9  ARRAY(0x99f8f00)
      0  'restart|r!'
      1  'use Catalyst::Restarter to detect code changes and restart the
application'
      2  HASH(0x99f8ac0)
           empty hash
   10  ARRAY(0x99fddc8)
      0  'restart_directory|rdir|restartdirectory=3Ds@'
      1  'Restarter directory to watch'
      2  HASH(0x99f8b40)
           empty hash
   11  ARRAY(0x99fe0b8)
      0  'restart_delay|rd=3Di'
      1  'Set a restart delay'
      2  HASH(0x99fe1d8)
           empty hash
   12  ARRAY(0x99f92f0)
      0  'restart_regex|rr=3Ds'
      1  'Restart regex'
      2  HASH(0x99fdb18)
           empty hash
   13  ARRAY(0x99f03b8)
      0  'follow_symlinks|sym!'
      1  'Follow symbolic links'
      2  HASH(0x99fe288)
           empty hash
   14  ARRAY(0x9a12cd0)
      0  'restarter_class=3Ds'
      1  ' '
      2  HASH(0x99f8680)
           empty hash

  DB<5> *x \%params*
0  HASH(0x98782f0)
   'options' =3D> ARRAY(0x8c68400)
      0  HASH(0x9441168)
         'doc' =3D> 'The class to use to detect and load the PSGI engine'
         'init_arg' =3D> 'loader_class'
         'name' =3D> 'loader_class'
         'opt_string' =3D> 'loader_class=3Ds'
         'required' =3D> undef
      1  HASH(0x99fdb88)
         'doc' =3D> 'Prints this usage information.'
         'init_arg' =3D> 'help_flag'
         'name' =3D> 'help'
         'opt_string' =3D> 'help|usage|?|h!'
         'required' =3D> undef
      2  HASH(0x935d890)
         'doc' =3D> 'Force debug mode'
         'init_arg' =3D> 'debug'
         'name' =3D> 'debug'
         'opt_string' =3D> 'debug|d!'
         'required' =3D> undef
      3  HASH(0x9441a28)
         'doc' =3D> 'Specify a hostname or IP on this host for the server to
bind to'
         'init_arg' =3D> 'host'
         'name' =3D> 'host'
         'opt_string' =3D> 'host|h=3Ds'
         'required' =3D> undef
      4  HASH(0x9441898)
         'doc' =3D> 'Fork the server to be able to serve multiple requests =
at
once'
         'init_arg' =3D> 'fork'
         'name' =3D> 'fork'
         'opt_string' =3D> 'fork|f!'
         'required' =3D> undef
      5  HASH(0x9440e98)
         'doc' =3D> 'Specify a different listening port (to the default port
3000)'
         'init_arg' =3D> 'port'
         'name' =3D> 'port'
         'opt_string' =3D> 'port|p=3Di'
         'required' =3D> undef
      6  HASH(0x9059388)
         'doc' =3D> 'Specify a pidfile'
         'init_arg' =3D> 'pidfile'
         'name' =3D> 'pidfile'
         'opt_string' =3D> 'pidfile|pid=3Ds'
         'required' =3D> undef
      7  HASH(0x9441798)
         'doc' =3D> 'Support keepalive'
         'init_arg' =3D> 'keepalive'
         'name' =3D> 'keepalive'
         'opt_string' =3D> 'keepalive|k!'
         'required' =3D> undef
      8  HASH(0x9441178)
         'doc' =3D> 'Run in the background'
         'init_arg' =3D> 'background'
         'name' =3D> 'background'
         'opt_string' =3D> 'background|bg!'
         'required' =3D> undef
      9  HASH(0x94411a8)
         'doc' =3D> 'use Catalyst::Restarter to detect code changes and
restart the application'
         'init_arg' =3D> 'restart'
         'name' =3D> 'restart'
         'opt_string' =3D> 'restart|r!'
         'required' =3D> undef
      10  HASH(0x9441128)
         'doc' =3D> 'Restarter directory to watch'
         'init_arg' =3D> 'restart_directory'
         'name' =3D> 'restart_directory'
         'opt_string' =3D> 'restart_directory|rdir|restartdirectory=3Ds@'
         'required' =3D> undef
      11  HASH(0x94411b8)
         'doc' =3D> 'Set a restart delay'
         'init_arg' =3D> 'restart_delay'
         'name' =3D> 'restart_delay'
         'opt_string' =3D> 'restart_delay|rd=3Di'
         'required' =3D> undef
      12  HASH(0x9441028)
         'doc' =3D> 'Restart regex'
         'init_arg' =3D> 'restart_regex'
         'name' =3D> 'restart_regex'
         'opt_string' =3D> 'restart_regex|rr=3Ds'
         'required' =3D> undef
      13  HASH(0x943dc10)
         'doc' =3D> 'Follow symbolic links'
         'init_arg' =3D> 'follow_symlinks'
         'name' =3D> 'follow_symlinks'
         'opt_string' =3D> 'follow_symlinks|sym!'
         'required' =3D> undef
      14  HASH(0x943d880)
         'init_arg' =3D> 'restarter_class'
         'name' =3D> 'restarter_class'
         'opt_string' =3D> 'restarter_class=3Ds'
         'required' =3D> undef
   'params' =3D> HASH(0x942e5d0)
      'application_name' =3D> 'Waste::Web'

Looks like a red herring to me... Still quite a puzzle!

Disabling the cache is allowing the app to launch, so there's that. :(
Further pointers welcome!


On Sat, Mar 30, 2013 at 6:55 PM, Tomas Doran <bobtfish at bobtfish.net> wrote:

> 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 look=
ed
> 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 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/Scrip=
t/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/Catal=
yst/ScriptRole.pm:88):
> > 88:         my $self =3D shift;
> >
> > DB<1> n
> >
> Catalyst::ScriptRole::_run_application(/usr/local/share/perl/5.10.1/Catal=
yst/ScriptRole.pm:89):
> > 89:         my $app =3D $self->application_name;
> >
> > DB<1> n
> >
> Catalyst::ScriptRole::_run_application(/usr/local/share/perl/5.10.1/Catal=
yst/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=3DHASH(=
0xa5e1660)')
> called at /usr/local/share/perl/5.10.1/Catalyst/Script/Server.pm line 240
> >
>  Catalyst::Script::Server::run('Catalyst::Script::Server=3DHASH(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/
>
>
> _______________________________________________
> 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/20130331/7bbba=
cbf/attachment.htm


More information about the Catalyst mailing list