Types::DBI - type constraints for dealing with relational databases
package FroobleBase; use Moose; use Types::DBI; has dbh => ( is => 'ro', isa => Dbh['PostgreSQL'], coerce => 1, required => 1, );
This module provides two type constraints, but only
Dbh is exported by default.
A class type for DBI database handles (DBI::db objects). Coercions from:
The string will be passed to
DBI->connectas the DSN. Empty strings will be supplied as the username and password parameters. (Many databases allow the username and password to be specified as part of the DSN. Some databases like SQLite can be usefully used without any authentication details.) The
RaiseErrorattribute will be set to true.
The arrayref will be dereferenced and passed to
Dbhcan be parameterized with one or more database names:
isa => Dbh["SQLite"] isa => Dbh[qw/ SQLite PostgreSQL /]
The database names must be a case-sensitive match for the strings returned by
Coercions are inherited from non-parameterized
A class type for DBI statement handles (DBI::st objects). No coercions.
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Types-DBI.
Toby Inkster <email@example.com>.
This software is copyright (c) 2014 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.