debian man page for dbicx::testdatabase::subclass

Query: dbicx::testdatabase::subclass

OS: debian

Section: 3pm

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

DBICx::TestDatabase::Subclass(3pm)			User Contributed Perl Documentation			DBICx::TestDatabase::Subclass(3pm)

NAME
DBICx::TestDatabase::Subclass - a DBICx::TestDatabase you can add your own methods to
SYNOPSIS
Your test database subclass: package MyApp::TestDatabase use base qw(DBICx::TestDatabase::Subclass MyApp::Schema); sub foo { my $self = shift; return $self->resultset('Foo')->create({ foo => 'bar' }); } Later: use MyApp::TestDatabase; my $schema = MyApp::TestDatabase->connect; my $foo_row = $schema->foo; # MyApp::TestDatabase::foo my $bars = $schema->resultset('Bar'); # MyApp::Schema::resultset
DESCRIPTION
Sometimes DBICx::TestDatabase doesn't give you enough control over the object returned. This module lets you create a custom test database class.
METHODS
connect This method creates the temporary database and returns the connection. If your subclass needs to change the way connect works, do something like this: sub connect { my ($class) = @_; say 'This happens before we create the test database.'; my $schema = $class->next::method; say '$schema is the temporary test database'; return $schema; }
SEE ALSO
If you want a simple test database based on a DBIC schema, just use DBICx::TestDatabase.
AUTHOR
Jonathan Rockway "<jrockway@cpan.org>"
LICENSE
Copyright (c) 2007 Jonathan Rockway. This program is free software. You may use, modify, and redistribute it under the same terms as Perl itself. perl v5.10.1 2007-10-07 DBICx::TestDatabase::Subclass(3pm)
Related Man Pages
dbix::class::manual::quickstart(3) - mojave
sql::translator::parser::dbix::class5.18(3) - mojave
dbicx::testdatabase(3pm) - debian
dbicx::testdatabase::subclass(3pm) - debian
dbix::class::resultsource::view(3pm) - debian
Similar Topics in the Unix Linux Community
¿how can I connect C to a database?
How to connect database in TC
Grep with wildcard in middle of word
Oracle Data BackUp with Help Of Perl
script for connecting database in loops