[Catalyst] how to reuse Catalyst Schema for non-web purposes?
kakimoto at tpg.com.au
kakimoto at tpg.com.au
Wed Apr 22 22:12:23 GMT 2009
Hello. Matt,
Good morning.
Here's the execution output of the regression test and source code of
the regression test.
-------------------- Execution of test - start ------------------------
kakimoto at dev-machine:~/projects/myApp/t$ prove -v userSubscriptions.t
userSubscriptions.t ..
ok 1 - use myApp::Schema::UserSubscriptions;
ok 2 - The object isa myApp::Schema::UserSubscriptions
ok 3 - myApp::Schema::UserSubscriptions->can('subscriptions_id')
ok 4 - myApp::Schema::UserSubscriptions->can('name')
ok 5 - myApp::Schema::UserSubscriptions->can('user_id')
ok 6 - myApp::Schema::UserSubscriptions->can('comments')
ok 7 - myApp::Schema::UserSubscriptions->can('rea_agent_code')
1..7
Can't call method "resolve" on an undefined value at
/usr/local/lib/perl5/site_perl/5.8.9/DBIx/Class/Row.pm line 720.
# Looks like your test exited with 255 just after 7.
Dubious, test returned 255 (wstat 65280, 0xff00)
All 7 subtests passed
Test Summary Report
-------------------
userSubscriptions.t (Wstat: 65280 Tests: 7 Failed: 0)
Non-zero exit status: 255
Files=1, Tests=7, 3 wallclock secs ( 0.02 usr 0.01 sys + 0.17 cusr
0.03 csys = 0.23 CPU)
Result: FAIL
-------------------- Execution of test - end ------------------------
------------------ Regression test source-start------------------
use strict;
use warnings;
use FindBin;
use File::Spec qw();
use lib File::Spec->catdir($FindBin::Bin, qw(.. lib));
use Test::More qw(no_plan);
my $package_name = 'myApp::Schema::UserSubscriptions';
BEGIN {
use_ok( 'myApp::Schema::UserSubscriptions' );
}
# Set up a user's subscriptions.
my %existing_agent = (
qq{username} => qq{test_back_end_agent},
);
my @user_subscriptions = (
{
'name' => 'first subscription',
'subscriptions_id' => '12',
'user_id' => $existing_agent{'username'},
'comments' => 'test user subscription',
'agent_code' => 'LATHAM',
},
);
foreach my $new_subscription ( @user_subscriptions )
{
my $new_user_sub = $package_name->new();
isa_ok ( $new_user_sub, $package_name );
foreach my $attr ( keys %{$new_subscription} )
{
can_ok ($new_user_sub, $attr);
$new_user_sub->$attr($new_subscription);
}
$new_user_sub->insert();
}
------------------ Regression test source-end------------------
Thank you.
K.akimoto
Quoting Matt S Trout <dbix-class at trout.me.uk>:
> On Wed, Apr 22, 2009 at 02:41:34PM +1000, kakimoto at tpg.com.au wrote:
> > hi guys,
> > I just looked at my app and found that I need to reuse the
> Schema
> > files found in my 'Schema' directory.
>
> Your DBIC classes aren't connected to the Catalyst app at all.
> That's
> intentional. Just use DBIx::Class the way DBIx::Class is documented
> in and
> of itself. The DBIx::Class list is also on http://lists.scsys.co.uk/
> if you
> get stuck - if you're getting an error show your code and the
> complete error
> on there.
>
> --
> Matt S Trout Need help with your Catalyst or DBIx::Class
> project?
> Technical Director
> http://www.shadowcat.co.uk/catalyst/
> Shadowcat Systems Ltd. Want a managed development or deployment
> platform?
> http://chainsawblues.vox.com/
> http://www.shadowcat.co.uk/servers/
>
> _______________________________________________
> 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