MooX::Role::DBIConnection - handy mixin for objects with a DB connection
{ package My::Example; use Moo 2; with 'MooX::Role::DBIConnection'; }; # Connect using the parameters my $writer = My::Example->new( dbh => { dsn => '...', user => '...', password => '...', options => '...', }, ); # ... or alternatively if you have a connection already my $writer2 = My::Example->new( dbh => $dbh, );
This module enhances your class constructor by allowing you to pass in either a premade dbh or the parameters needed to create one.
dbh
It will create the dbh accessor
This module will likely be spun out of the Weather::MOSMIX distribution
The public repository of this module is https://github.com/Corion/weather-mosmix.
The public support forum of this module is https://perlmonks.org/.
Please report bugs in this module via the RT CPAN bug queue at https://rt.cpan.org/Public/Dist/Display.html?Name=Weather-MOSMIX or via mail to www-Weather-MOSMIX@rt.cpan.org.
Max Maischein corion@cpan.org
corion@cpan.org
Copyright 2019-2020 by Max Maischein corion@cpan.org.
This module is released under the same terms as Perl itself.
To install Weather::MOSMIX, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Weather::MOSMIX
CPAN shell
perl -MCPAN -e shell install Weather::MOSMIX
For more information on module installation, please visit the detailed CPAN module installation guide.