DBIx::Connect

DBIx::Connect is a Perl module that allows DBI, DBIx::AnyDBD, and Alzabo database connection (info) via AppConfig.
Download

DBIx::Connect Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • T. M. Brannon and Martin Jackson
  • Publisher web site:
  • http://search.cpan.org/~tbone/DBIx-Connect-1.13/lib/DBIx/Connect.pm

DBIx::Connect Tags


DBIx::Connect Description

DBIx::Connect is a Perl module that allows DBI, DBIx::AnyDBD, and Alzabo database connection (info) via AppConfig. DBIx::Connect is a Perl module that allows DBI, DBIx::AnyDBD, and Alzabo database connection (info) via AppConfig.SYNOPSIS # .cshrc setenv APPCONFIG /Users/metaperl/.appconfig setenv DBIX_CONN "${APPCONFIG}-dbi" # Note that the DBIX_CONN environment variable is now optional - # a file can be specified using the command line parameter # -dbix_conn_file, e.g.: perl dbi_script.pl -dbix_conn_file /Users/metaperl/.appconfig-dbi # Any number of blocks may be specified in the config file - one block # per connection handle. Any of the options specified in the file # can be overridden # by using the command line syntax shown below. # .appconfig-dbi user= postgres pass = dsn= dbi:Pg:dbname=mydb attr RaiseError = 0 attr PrintError = 0 attr Taint = 1 user = root pass = w00t! dsn = dbi:mysql:database=mysqldb;host=localhost attr RaiseError = 1 attr PrintError = 1 # DBIx::AnyDBD usage: my @connect_data = DBIx::Connect->data_array('dev_db'); my $dbh = DBIx::AnyDBD->connect(@connect_data, "MyClass"); # Alzabo usage my %connect_data = DBIx::Connect->data_hash('dev_db'); # pure DBI usage use DBIx::Connect; my $dbh = DBIx::Connect->to('dev_db'); # over-ride .appconfig-dbi from the command line # not recommended for passwords as C will reveal the password perl dbi-script.pl basic -dbix_conn_file .appconfig-dbi -basic_user tim_bunce -basic_pass dbi_rocks perl dbi-script.pl basic -basic_attr "RaiseError=1" -basic_attr "Taint=0" # Note that all parameters can be specified on the command line, # so the file is not strictly necessary. As a practical matter, # this is not a likely scenario, but it is supported. perl dbi-script.pl -basic_user basic -basic_pass "" -basic_dsn "dbi:Pg:dbname=basic" -basic_attr "AutoCommit=0"DBIx::Connect will croak wth the DBI error if it cannot create a valid database handle.This module facilitates DBI -style, DBIx::AnyDBD -style, or Alzabo -style database connections for sites and applications which make use of AppConfig and related modules to configure their applications via files and/or command-line arguments.It provides three methods, to, data_array, and data_hash which return a DBI database handle and an array of DBI connection info, respectively.Each of the 4 DBI connection parameters (username, password, dsn, attr) can be defined via any of the methods supported by AppConfig, meaning via a configuration file, or simple-style command-line arguments. AppConfig also provides support for both simple and Getopt::Long style, but Getopt::Long is overkill for a module this simple. Requirements: · Perl


DBIx::Connect Related Software