Well I'm kinda new to Catalyst and the MVC world myself, and I would have
tried exactly what you've tried. So my small-time suggestion to you is to
try it with perl debugging on, and then use this to drop into single-step
mode somewhere prescient:

$DB::single = 1;

Then you
$ perl -d script/easysaver_server.pl
> c

In particular if you can figure out where it's going to get the database
connection established, right before then would be a great place for
$DB::single. :) Somewhere in there it's apparently treating things a bit
differently than normal DBI code... If you can step through that you'll
likely find out what's going on.

Hope this helps, at least a little... :)


On Sun, May 23, 2010 at 11:38 AM, Dan <[email protected]> wrote:

> Greetings.
>
> I realise that this is slightly off-topic ... I tried to sign up to the
> DBIC mailing list, but haven't received anything yet ( and have checked
> spam filter ).
>
> I'm trying to teach myself Catalyst. At the same time, I'm trying to get
> my head around a whole heap of other things, eg MVC ( read about but not
> used ), DBIC, JSON, JQuery ... more than I'd like to learn all at once
> to be honest.
>
> I can find *no* documentation on setting up a connection to a remote
> MySQL server, anywhere.
>
> I created a model with the _create.pl script, and edited the package
> config thing to look like this:
>
> __PACKAGE__->config(
>    schema_class => 'EasySaver',
>
>    connect_info => {
>        dsn => 'dbi:mysql:dbname=EasySaver;host=archeopteryx',
>        user => 'username',
>        password => 'password',
>        AutoCommit => q{1},
>    }
> );
>
> Doesn't work.
>
> Also tried this:
>
> __PACKAGE__->config(
>    schema_class => 'EasySaver',
>
>    connect_info => {
>        dsn => 'dbi:mysql:EasySaver',
>        host => 'archeopteryx',
>        user => 'EasySaver',
>        password => 'loaderup',
>        AutoCommit => q{1},
>    }
> );
>
> Also doesn't work.
>
> When I try to start the server:
>
> export DBIC_TRACE=1
> script/easysaver_server.pl -r
>
>  ... I get a MASSIVE stack trace, which I've pasted at the bottom of
> this message.
>
> Does anyone have a working example for specifying a server IP / hostname
> for a MySQL connection?
>
> Thanks :)
>
> Dan
>
> Couldn't load class (EasySaver) because: Couldn't instantiate component
> "EasySaver::Model::ESDB", "Attribute (schema_class) does not pass the
> type constraint because: Validation failed for
> 'Catalyst::Model::DBIC::Schema::Types::SchemaClass' failed with value
> EasySaver
> at
> /usr/lib/perl5/site_perl/5.10.1/i686-linux-thread-multi/Moose/Meta/Attribute.pm
> line 746
>
> Moose::Meta::Attribute::_coerce_and_verify('Moose::Meta::Attribute=HASH(0x995cbb0)',
> 'EasySaver', 'EasySaver::Model::ESDB=HASH(0x9998ee0)') called at
> /usr/lib/perl5/site_perl/5.10.1/i686-linux-thread-multi/Moose/Meta/Attribute.pm
> line 398
>
> Moose::Meta::Attribute::initialize_instance_slot('Moose::Meta::Attribute=HASH(0x995cbb0)',
> 'Moose::Meta::Instance=HASH(0x9a62198)',
> 'EasySaver::Model::ESDB=HASH(0x9998ee0)', 'HASH(0x9998a50)') called at
> /usr/lib/perl5/site_perl/5.10.1/i686-linux-thread-multi/Class/MOP/Class.pm
> line 364
>
> Class::MOP::Class::_construct_instance('Moose::Meta::Class=HASH(0x992c120)',
> 'HASH(0x9998a50)') called at
> /usr/lib/perl5/site_perl/5.10.1/i686-linux-thread-multi/Class/MOP/Class.pm
> line 351
>        Class::MOP::Class::new_object('Moose::Meta::Class=HASH(0x992c120)',
> 'HASH(0x9998a50)') called
> at
> /usr/lib/perl5/site_perl/5.10.1/i686-linux-thread-multi/Moose/Meta/Class.pm
> line 255
>        Moose::Meta::Class::new_object('Moose::Meta::Class=HASH(0x992c120)',
> 'HASH(0x9998a50)') called
> at /usr/lib/perl5/site_perl/5.10.1/i686-linux-thread-multi/Moose/Object.pm
> line 25
>        Moose::Object::new('EasySaver::Model::ESDB', 'EasySaver',
> 'HASH(0x996c840)') called at generated method (unknown origin) line 3
>        Catalyst::Model::DBIC::Schema::new('EasySaver::Model::ESDB',
> 'EasySaver', 'HASH(0x996c840)') called
> at /usr/lib/perl5/site_perl/5.10.1/MooseX/Traits/Pluggable.pm line 131
>        MooseX::Traits::Pluggable::new_with_traits('EasySaver::Model::ESDB',
> 'EasySaver') called
> at /usr/lib/perl5/site_perl/5.10.1/CatalystX/Component/Traits.pm line
> 145
>        CatalystX::Component::Traits::COMPONENT('EasySaver::Model::ESDB',
> 'EasySaver', 'HASH(0x9a5eea0)') called
> at
> /usr/lib/perl5/site_perl/5.10.1/i686-linux-thread-multi/Class/MOP/Method/Wrapped.pm
> line 48
>        Class::MOP::Method::Wrapped::__ANON__('EasySaver::Model::ESDB',
> 'EasySaver', 'HASH(0x9a5eea0)') called
> at
> /usr/lib/perl5/site_perl/5.10.1/i686-linux-thread-multi/Class/MOP/Method/Wrapped.pm
> line 89
>        Catalyst::Model::DBIC::Schema::COMPONENT('EasySaver::Model::ESDB',
> 'EasySaver', 'HASH(0x9a5eea0)') called
> at /usr/lib/perl5/site_perl/5.10.1/Catalyst.pm line 2507
>        eval {...} called at /usr/lib/perl5/site_perl/5.10.1/Catalyst.pm
> line
> 2507
>        Catalyst::setup_component('EasySaver', 'EasySaver::Model::ESDB')
> called
> at /usr/lib/perl5/site_perl/5.10.1/Catalyst.pm line 2421
>        Catalyst::setup_components('EasySaver') called
> at /usr/lib/perl5/site_perl/5.10.1/Catalyst.pm line 1143
>        Catalyst::setup('EasySaver') called
> at /home/dan/src/EasySaver/script/../lib/EasySaver.pm line 42
>        require EasySaver.pm called
> at /usr/lib/perl5/site_perl/5.10.1/i686-linux-thread-multi/Class/MOP.pm
> line 101
>        Class::MOP::__ANON__() called
> at /usr/lib/perl5/site_perl/5.10.1/Try/Tiny.pm line 71
>        eval {...} called at /usr/lib/perl5/site_perl/5.10.1/Try/Tiny.pm
> line
> 67
>        Try::Tiny::try('CODE(0x95d4400)', 'Try::Tiny::Catch=REF(0x967ee90)')
> called
> at /usr/lib/perl5/site_perl/5.10.1/i686-linux-thread-multi/Class/MOP.pm
> line 110
>        Class::MOP::load_first_existing_class('EasySaver') called
> at /usr/lib/perl5/site_perl/5.10.1/i686-linux-thread-multi/Class/MOP.pm
> line 121
>        Class::MOP::load_class('EasySaver') called
> at /usr/lib/perl5/site_perl/5.10.1/Catalyst/ScriptRole.pm line 61
>
> Catalyst::ScriptRole::_run_application('Catalyst::Script::Server=HASH(0x92d0248)')
> called at /usr/lib/perl5/site_perl/5.10.1/Catalyst/Script/Server.pm line 144
>        Catalyst::Script::Server::__ANON__() called
> at /usr/lib/perl5/site_perl/5.10.1/Catalyst/Restarter/Forking.pm line 20
>
> Catalyst::Restarter::Forking::_fork_and_start('Catalyst::Restarter::Forking=HASH(0x95d5190)')
> called at /usr/lib/perl5/site_perl/5.10.1/Catalyst/Restarter.pm line 80
>
> Catalyst::Restarter::run_and_watch('Catalyst::Restarter::Forking=HASH(0x95d5190)')
> called at /usr/lib/perl5/site_perl/5.10.1/Catalyst/Script/Server.pm line 178
>
> Catalyst::Script::Server::run('Catalyst::Script::Server=HASH(0x92d0248)')
> called at
> /usr/lib/perl5/site_perl/5.10.1/i686-linux-thread-multi/Class/MOP/Method/Wrapped.pm
> line 48
>
> Class::MOP::Method::Wrapped::__ANON__('Catalyst::Script::Server=HASH(0x92d0248)')
> called at
> /usr/lib/perl5/site_perl/5.10.1/i686-linux-thread-multi/Class/MOP/Method/Wrapped.pm
> line 89
>
> Catalyst::Script::Server::run('Catalyst::Script::Server=HASH(0x92d0248)')
> called at /usr/lib/perl5/site_perl/5.10.1/Catalyst/ScriptRunner.pm line 20
>        Catalyst::ScriptRunner::run('Catalyst::ScriptRunner', 'EasySaver',
> 'Server') called at script/easysaver_server.pl line 8"Compilation failed
> in require
> at /usr/lib/perl5/site_perl/5.10.1/i686-linux-thread-multi/Class/MOP.pm
> line 101.
>  at /usr/lib/perl5/site_perl/5.10.1/i686-linux-thread-multi/Class/MOP.pm
> line 105
>        Class::MOP::__ANON__('Couldn\'t instantiate component
> "EasySaver::Model::ESDB", "At...') called
> at /usr/lib/perl5/site_perl/5.10.1/Try/Tiny.pm line 98
>        Try::Tiny::try('CODE(0x95d4400)', 'Try::Tiny::Catch=REF(0x967ee90)')
> called
> at /usr/lib/perl5/site_perl/5.10.1/i686-linux-thread-multi/Class/MOP.pm
> line 110
>        Class::MOP::load_first_existing_class('EasySaver') called
> at /usr/lib/perl5/site_perl/5.10.1/i686-linux-thread-multi/Class/MOP.pm
> line 121
>        Class::MOP::load_class('EasySaver') called
> at /usr/lib/perl5/site_perl/5.10.1/Catalyst/ScriptRole.pm line 61
>
> Catalyst::ScriptRole::_run_application('Catalyst::Script::Server=HASH(0x92d0248)')
> called at /usr/lib/perl5/site_perl/5.10.1/Catalyst/Script/Server.pm line 144
>        Catalyst::Script::Server::__ANON__() called
> at /usr/lib/perl5/site_perl/5.10.1/Catalyst/Restarter/Forking.pm line 20
>
> Catalyst::Restarter::Forking::_fork_and_start('Catalyst::Restarter::Forking=HASH(0x95d5190)')
> called at /usr/lib/perl5/site_perl/5.10.1/Catalyst/Restarter.pm line 80
>
> Catalyst::Restarter::run_and_watch('Catalyst::Restarter::Forking=HASH(0x95d5190)')
> called at /usr/lib/perl5/site_perl/5.10.1/Catalyst/Script/Server.pm line 178
>
> Catalyst::Script::Server::run('Catalyst::Script::Server=HASH(0x92d0248)')
> called at
> /usr/lib/perl5/site_perl/5.10.1/i686-linux-thread-multi/Class/MOP/Method/Wrapped.pm
> line 48
>
> Class::MOP::Method::Wrapped::__ANON__('Catalyst::Script::Server=HASH(0x92d0248)')
> called at
> /usr/lib/perl5/site_perl/5.10.1/i686-linux-thread-multi/Class/MOP/Method/Wrapped.pm
> line 89
>
> Catalyst::Script::Server::run('Catalyst::Script::Server=HASH(0x92d0248)')
> called at /usr/lib/perl5/site_perl/5.10.1/Catalyst/ScriptRunner.pm line 20
>        Catalyst::ScriptRunner::run('Catalyst::ScriptRunner', 'EasySaver',
> 'Server') called at script/easysaver_server.pl line 8
>
>
> _______________________________________________
> List: [email protected]
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/[email protected]/
> Dev site: http://dev.catalyst.perl.org/
>



-- 
will trillich
"It's only by saying 'no' that you can concentrate on the things that are
really important." -- Steve Jobs
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to