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

2013-03-30 Thread will trillich
$ *perl -wMDevel::SimpleTrace script/waste_web_server.pl *
Duplicate specification "host|h=s" 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/Getopt/Basic.pm:138)
at
MooseX::Getopt::Basic::process_argv(/usr/local/share/perl/5.10.1/MooseX/Getopt/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/ScriptRunner.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/Catalyst/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/ScriptRunner.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 ) = try {
132:b   local $SIG{__WARN__} = sub { push @warnings, @_ };
133
134==>  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=s'
  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=s'
  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=i'
  1  'Specify a different listening port (to the default port 3000)'
  2  HASH(0x943d4f0)
   empty hash
   6  ARRAY(0x9a03f38)
  0  'pidfile|pid=s'
  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=s@'
  1  'Restarter directory to watch'
  2  HASH(0x99f8b40)
   empty hash
   11  ARRAY(0x99fe0b8)
  0  'restart_delay|rd=i'
  1  'Set a restart delay'
  2  HASH(0x99fe1d8)
   empty hash
   12  ARRAY(0x99f92f0)
  0  'restart_regex|rr=s'
  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=s'
  1  ' '
  2  HASH(0x99f8680)
   empty hash

  DB<5> *x \%params*
0  HASH(0x98782f0)
   'options' => ARRAY(0x8c68400)
  0  HASH(0x9441168)
 'doc' => 'The class to use to detect and load the PSGI engine'
 'init_arg' => 'loader_class'
 'name' => 'loader_class'
 'opt_string' => 'loader_class=s'
 'required' => undef
  1  HASH(0x99fdb88)
 'doc' => 'Prints this usage information.'
 'init_arg' => 'help_flag'
 'name' => 'help'
 'opt_string' => 'help|usage|?|h!'
 'required' => undef
  2  HASH(0x935d890)
 'doc' => 'Force debug mode'
 'init_arg' => 'debug'
 'name' => 'debug'
 'opt_string' => 'debug|d!'
 'required' => undef
  3  HASH(0x9441a28)
 'doc' => 'Specify a hostname or IP on this host for the server to
bind to'
 'init_arg' => 'host'

Re: [Catalyst] How to get IP address of the interface which therequest come through

2013-03-30 Thread N.A.

Thank you all,

I can't find `more direct way of getting the IP address' nor way of 
getting the network interface of the HTTP-request.  The following is 
summary of what I learned from this ML and source code.



  -  'SERVER_ADDR' environment variable is not portable.
   PSGI  Specification says nothing on this variable.

  - It is HTTP server, not the Catalyst who chooses to support
   this variable or not.

   The lighttpd support 'SERVER_ADDR',
   the nginx needs additional configuration to support this, and
   HTTP::Server::PSGI(which is used by Catalyst test server) doesn't
   support.

 - In many cases, host name( '$c->req->uri->host' ) is more suitable
   because it is  IP version neutral.

N.A.

(2013年03月24日 15:33), Octavian Rasnita wrote:

From: "N.A." 
To: 


 >> I wan to get the  IP address of the interface(network device)
which the
 >> request come through.
 >
 > My bad.




Unless there is a more direct way of getting the IP address, you can
create distinct virtual hosts for each IP address that can access your
web app and set an HTTP environment variable that specifies that IP
address. Then read that env var in your app.

--Octavian


___
List: Catalyst@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@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/


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

2013-03-30 Thread Tomas Doran
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  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@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/


_

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

2013-03-30 Thread will trillich
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  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.trill...@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 against
>> "Spill" which seems to have no problems at all...
>>
>> package Class::Accessor::Fast;
>> use base 'Class::Accessor';
>> use strict;
>> $Class::Accessor::Fast::VERSION = '0.34';
>>
>> sub make_accessor {
>> my($class, $field) = @_;
>>
>> return sub {
>> return $_[0]->{$field} if scalar(@_) == 1; *# <== $_[0] is
>> string "Waste::Web" so boom!*
>> return $_[0]->{$field}  = scalar(@_) == 2 ? $_[1] : [@_[1..$#_]];
>> };
>> }
>>
>> $ = Catalyst::Plugin::Cache::_default_curried_cache('Waste::Web') called
>> from file `/usr/share/perl5/Catalyst/Plugin/Cache.pm' line 159
>> $ = Catalyst::Plugin::Cache::cache('Waste::Web') called from file
>> `/usr/share/perl5/Catalyst/TraitFor/Model/DBIC/Schema/Caching.pm' line 88
>> . =
>> 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
>> $ =
>> Class::MOP::Method::Wrapped::__ANON__[/usr/local/lib/perl/5.10.1/Class/MOP/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
>> $ =
>> 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
>> $ = 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
>> $ = Catalyst::model('Waste::Web', 'Waste') called from file
>> `/usr/share/perl5/Catalyst/Model/DBIC/Schema.pm' line 549
>> $ =
>> 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
>> $ = 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
>> $ = Catalyst::model('Waste::Web', 'Waste::Session', undef) called from
>> file `/usr/share/perl5/Catalyst/Plugin/Session/Store/DBIC.pm' line 145
>> $ =
>> Catalyst::Plugin::Session::Store::DBIC::session_store_model('Waste::Web')
>> called from file `/usr/share/perl5/Catalyst/Plugin/Session/Store/DBIC.pm'
>> line 78
>> . = Catalyst::Plugin::Session::Store::DBIC::setup_finished('Waste::Web',
>> 1) called from file `/usr/local/share/perl/5.10.1/Catalyst.pm' line 1233
>> . = Catalyst::setup_finalize('Waste::Web') called from file
>> `/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm' line 50
>> . =
>> Class::MOP::Method::Wrapped::__ANON__[/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm:51]('Waste::Web')
>> called from file `/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm'
>> line 91
>> . = Waste::Web::setup_finalize('Waste::Web') called from file
>> `/usr/local/share/perl/5.10.1/Catalyst.pm' line 1207
>> . = Catalyst::setup('Waste::Web') called from file
>> `/home/will/projects/perl-mvc/Waste/script/../lib/Waste/Web.pm' line 54
>> $ = require 'Waste/Web.pm' called from file
>> `/usr/local/share/perl/5.10.1/Module/Runtime.pm' line 317
>> . = Module::Runtime::require_module('Waste::Web') called from file
>> `/usr/local/share/perl/5.10.1/Class/Load.pm' line 177
>> @ =
>> 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
>> $ = eval {...} called from file
>> `/usr/local/share/perl/5.10.1/Try/Tiny.pm' line 67
>> @ = Try::Tiny::try(ref(CODE), ref(Try::Tiny::Catch)) called from file
>> `/usr/local/share/perl/5.10.1/Class/Load.pm' line 183
>> @ = Class::Load::try_load_class('Waste::Web', undef) called from file
>> `/usr/local/share/perl/5.10.1/Class/Load.pm' line 38
>> . = Class::Load::load_class('Waste::Web') called from file
>> `/usr/local/share/perl/5.10.1/Catalyst/ScriptRole.pm' line 90
>> . = Catalyst::ScriptRole::_run_application(ref(Catalyst::Script::Server))
>> called from file `/usr/local/share/perl/5.10.1/Catalyst/Script/Server.pm'
>> line 240
>> . = 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.trill...@serensoft.com> wrote:
>>
>>> Looks like it bombs out at $c-

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

2013-03-30 Thread Dimitar Petrov
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
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 against
> "Spill" which seems to have no problems at all...
>
> package Class::Accessor::Fast;
> use base 'Class::Accessor';
> use strict;
> $Class::Accessor::Fast::VERSION = '0.34';
>
> sub make_accessor {
> my($class, $field) = @_;
>
> return sub {
> return $_[0]->{$field} if scalar(@_) == 1; *# <== $_[0] is string
> "Waste::Web" so boom!*
> return $_[0]->{$field}  = scalar(@_) == 2 ? $_[1] : [@_[1..$#_]];
> };
> }
>
> $ = Catalyst::Plugin::Cache::_default_curried_cache('Waste::Web') called
> from file `/usr/share/perl5/Catalyst/Plugin/Cache.pm' line 159
> $ = Catalyst::Plugin::Cache::cache('Waste::Web') called from file
> `/usr/share/perl5/Catalyst/TraitFor/Model/DBIC/Schema/Caching.pm' line 88
> . =
> 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
> $ =
> Class::MOP::Method::Wrapped::__ANON__[/usr/local/lib/perl/5.10.1/Class/MOP/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
> $ =
> 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
> $ = 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
> $ = Catalyst::model('Waste::Web', 'Waste') called from file
> `/usr/share/perl5/Catalyst/Model/DBIC/Schema.pm' line 549
> $ =
> 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
> $ = 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
> $ = Catalyst::model('Waste::Web', 'Waste::Session', undef) called from
> file `/usr/share/perl5/Catalyst/Plugin/Session/Store/DBIC.pm' line 145
> $ =
> Catalyst::Plugin::Session::Store::DBIC::session_store_model('Waste::Web')
> called from file `/usr/share/perl5/Catalyst/Plugin/Session/Store/DBIC.pm'
> line 78
> . = Catalyst::Plugin::Session::Store::DBIC::setup_finished('Waste::Web',
> 1) called from file `/usr/local/share/perl/5.10.1/Catalyst.pm' line 1233
> . = Catalyst::setup_finalize('Waste::Web') called from file
> `/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm' line 50
> . =
> Class::MOP::Method::Wrapped::__ANON__[/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm:51]('Waste::Web')
> called from file `/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm'
> line 91
> . = Waste::Web::setup_finalize('Waste::Web') called from file
> `/usr/local/share/perl/5.10.1/Catalyst.pm' line 1207
> . = Catalyst::setup('Waste::Web') called from file
> `/home/will/projects/perl-mvc/Waste/script/../lib/Waste/Web.pm' line 54
> $ = require 'Waste/Web.pm' called from file
> `/usr/local/share/perl/5.10.1/Module/Runtime.pm' line 317
> . = Module::Runtime::require_module('Waste::Web') called from file
> `/usr/local/share/perl/5.10.1/Class/Load.pm' line 177
> @ =
> 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
> $ = eval {...} called from file `/usr/local/share/perl/5.10.1/Try/Tiny.pm'
> line 67
> @ = Try::Tiny::try(ref(CODE), ref(Try::Tiny::Catch)) called from file
> `/usr/local/share/perl/5.10.1/Class/Load.pm' line 183
> @ = Class::Load::try_load_class('Waste::Web', undef) called from file
> `/usr/local/share/perl/5.10.1/Class/Load.pm' line 38
> . = Class::Load::load_class('Waste::Web') called from file
> `/usr/local/share/perl/5.10.1/Catalyst/ScriptRole.pm' line 90
> . = Catalyst::ScriptRole::_run_application(ref(Catalyst::Script::Server))
> called from file `/usr/local/share/perl/5.10.1/Catalyst/Script/Server.pm'
> line 240
> . = 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.trill...@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

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

2013-03-30 Thread will trillich
Still digging deeper -- here's the "T"race for right before it tries to hit
the anonymous closure sub inside make_accessor: Comparing this against
"Spill" which seems to have no problems at all...

package Class::Accessor::Fast;
use base 'Class::Accessor';
use strict;
$Class::Accessor::Fast::VERSION = '0.34';

sub make_accessor {
my($class, $field) = @_;

return sub {
return $_[0]->{$field} if scalar(@_) == 1; *# <== $_[0] is string
"Waste::Web" so boom!*
return $_[0]->{$field}  = scalar(@_) == 2 ? $_[1] : [@_[1..$#_]];
};
}

$ = Catalyst::Plugin::Cache::_default_curried_cache('Waste::Web') called
from file `/usr/share/perl5/Catalyst/Plugin/Cache.pm' line 159
$ = Catalyst::Plugin::Cache::cache('Waste::Web') called from file
`/usr/share/perl5/Catalyst/TraitFor/Model/DBIC/Schema/Caching.pm' line 88
. =
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
$ =
Class::MOP::Method::Wrapped::__ANON__[/usr/local/lib/perl/5.10.1/Class/MOP/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
$ =
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
$ = 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
$ = Catalyst::model('Waste::Web', 'Waste') called from file
`/usr/share/perl5/Catalyst/Model/DBIC/Schema.pm' line 549
$ =
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
$ = 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
$ = Catalyst::model('Waste::Web', 'Waste::Session', undef) called from file
`/usr/share/perl5/Catalyst/Plugin/Session/Store/DBIC.pm' line 145
$ =
Catalyst::Plugin::Session::Store::DBIC::session_store_model('Waste::Web')
called from file `/usr/share/perl5/Catalyst/Plugin/Session/Store/DBIC.pm'
line 78
. = Catalyst::Plugin::Session::Store::DBIC::setup_finished('Waste::Web', 1)
called from file `/usr/local/share/perl/5.10.1/Catalyst.pm' line 1233
. = Catalyst::setup_finalize('Waste::Web') called from file
`/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm' line 50
. =
Class::MOP::Method::Wrapped::__ANON__[/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm:51]('Waste::Web')
called from file `/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm'
line 91
. = Waste::Web::setup_finalize('Waste::Web') called from file
`/usr/local/share/perl/5.10.1/Catalyst.pm' line 1207
. = Catalyst::setup('Waste::Web') called from file
`/home/will/projects/perl-mvc/Waste/script/../lib/Waste/Web.pm' line 54
$ = require 'Waste/Web.pm' called from file
`/usr/local/share/perl/5.10.1/Module/Runtime.pm' line 317
. = Module::Runtime::require_module('Waste::Web') called from file
`/usr/local/share/perl/5.10.1/Class/Load.pm' line 177
@ = 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
$ = eval {...} called from file `/usr/local/share/perl/5.10.1/Try/Tiny.pm'
line 67
@ = Try::Tiny::try(ref(CODE), ref(Try::Tiny::Catch)) called from file
`/usr/local/share/perl/5.10.1/Class/Load.pm' line 183
@ = Class::Load::try_load_class('Waste::Web', undef) called from file
`/usr/local/share/perl/5.10.1/Class/Load.pm' line 38
. = Class::Load::load_class('Waste::Web') called from file
`/usr/local/share/perl/5.10.1/Catalyst/ScriptRole.pm' line 90
. = Catalyst::ScriptRole::_run_application(ref(Catalyst::Script::Server))
called from file `/usr/local/share/perl/5.10.1/Catalyst/Script/Server.pm'
line 240
. = 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  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 = 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==>   my $model = $c->session_store_model;
>
> DB<24> *p $c->session_store_model*
> Can't use string ("Waste::Web") as a HASH ref wh

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

2013-03-30 Thread will trillich
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 = 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==>   my $model = $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  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 

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

2013-03-30 Thread will trillich
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@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/