DataSo...Driver(3pm)
π DataSo...Driver(3pm) β Driver Writer's Guide and base class π
okay bestie, welcome to the User Contributed Perl Documentation section, manual page DataSo...Driver(3pm) β this is the glow-up guide for anyone writing a DBIx::DataSource driver. it's the base class AND the instruction manual, which is honestly giving teacher-and-student at the same time and we love a multitasker π
β¨ NAME β¨
DBIx::DataSource::Driver β the Driver Writer's Guide and base class, all in one iconic lil package π
πΈ SYNOPSIS πΈ
first of all, you can just read the whole thing like this:
perldoc DBIx::DataSource::Driver;
or, if you're ready to actually be the driver (main character energy fr fr), you subclass it like this:
package DBIx::DataSource::FooBase;
use DBIx::DataSource::Driver;
@ISA = qw( DBIx::DataSource::Driver );
that's it. that's the whole vibe check β
π¦ DESCRIPTION π¦
so you wanna implement a driver for your database? slay. here's the tea, and there are exactly two routes, so pick your fighter:
- If you can create a database with an SQL command through DBI/DBD, simply provide a
parse_dsnclass method which returns a list consisting of the actual data source to use inDBI->connectand the SQL. (note the emphasis on actual β the real one, not the fake one, bestie π)
package DBIx::DataSource::NewDatabase;
use DBIx::DataSource::Driver;
@ISA = qw( DBIx::DataSource::Driver );
sub parse_dsn {
my( $class, $action, $dsn ) = @_;
# $action is `create' or `drop'
# for example, if you parse parse $dsn for $database,
# $sql = "$action $database";
# you can die on errors - it'll be caught
( $new_dsn, $sql );
}
couple things to clock here, no cap:
$actioniscreateordropβ that's the whole range, that's the assignment- the comment really does say "if you parse parse $dsn for $database" β yes, twice, that's how it's written, i'm not fixing it, i'm just reporting it π
- you can
dieon errors and it's fine, because it'll be caught π«Ά
- Otherwise, you'll need to write
create_databaseanddrop_databaseclass methods. your turn to do the work, bestie:
package DBIx::DataSource::NewDatabase;
sub create_database {
my( $class, $dsn, $user, $pass ) = @_;
# for success, return true
# for failure, die (it'll be caught)
}
sub drop_database {
my( $class, $dsn, $user, $pass ) = @_;
# for success, return true
# for failure, die (it'll be caught)
}
the contract is chef's kiss simple:
- for success, return true β
- for failure, die β and again, it'll be caught, so you're safe π§
π AUTHOR π
Ivan Kohler <ivan-dbix-datasource@420.am> β the original icon, we stan π
π COPYRIGHT π
Copyright (c) 2000 Ivan Kohler Copyright (c) 2000 Mail Abuse Prevention System LLC All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
like... free software AND same terms as Perl itself? generous queen behavior honestly π
π BUGS π
this section is literally empty. not "no known bugs", not a list, justβ¦ nothing. the void. the silence. do with that information what you will π
β SEE ALSO β
DBIx::DataSourceDBIx::DataSource::mysqlDBIx::DataSource::PgDBI
go read those next, iykyk πβ¨
and that's the whole page bestie β this was perl v5.34.0, dated 2022-06-13, straight out of the DataSo...Driver(3pm) files. go forth and write that driver, you're gonna eat π₯π
π¦ where this page comes from
- debian bookworm: libdbix-datasource-perl 0.02-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libdbix-datasource-perl 0.02-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libdbix-datasource-perl 0.02-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdbix-datasource-perl 0.02-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdbix-datasource-perl 0.02-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms