SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG
DONATE




YUM REPOSITORY

 
 

MAN page from Mandriva 2010 perl-DBICx-TestDatabase-0.20.0-1mdv2010.1.noarch.rpm

DBICx::TestDatabase::Subclass

Section: User Contributed Perl Documentation (3)
Updated: 2007-10-07
Index 

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 theobject returned. This module lets you create a custom test databaseclass. 

METHODS

 

connect

This method creates the temporary database and returns the connection.If your subclass needs to change the way connect works, do something likethis:

    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 useDBICx::TestDatabase. 

AUTHOR

Jonathan Rockway "<jrockwayAATTcpan.org>" 

LICENSE

Copyright (c) 2007 Jonathan Rockway.

This program is free software. You may use, modify, and redistributeit under the same terms as Perl itself.


 

Index

NAME
SYNOPSIS
DESCRIPTION
METHODS
connect
SEE ALSO
AUTHOR
LICENSE

This document was created byman2html,using the manual pages.