Hello Monks,

I have inherited some code, well actually alot of code that needs to be installed for a new client. The original author seems to be intentionally avoiding helping me out and has provided very little assistance, thus I am turning to you for some guidance.

The code that he is using to connect with DBI is as follows...

sub new { my ($class, %flags) = @_; my ($self) = {}; bless $self, ref($class) || $class; my $server = $flags{'-server'} || $ENV{'DBISERVER'} || die "No ser +ver specified!\n"; my $user = $flags{'-user'} || 'undef'; my $pass = $flags{'-pass'}; $self->{_DB_NORM_HANDLE} = DBI->connect('dbi:' . $server, $user, $ +pass, { RaiseError => 0, AutoCommit => 1 } ) or croak "Cannot connect + to $ENV{'DBISERVER'}\n"; return $self; }
The confusing part is the connect string is defined via a custom apache environment variable which he instructs as follows...
DBISERVER <dbi connect string>
I can handle this within the httpd conf file or even htacess, but what is the correct syntax?

Additionally, the DBI->connect string needs to be able to connect to a specific database on a remote server which is not accounted for in his code.

1) What changes are to be made to the DBI->connect?

2) How do I properly define the custom environment variable

Could someone assist in this matter assuming the following variables...

remote host: somedomain.com
mySQL DB: main_DB
mysql user: charlie
mysql pass: opensesame
TIA for any guidance...

In reply to DBI question by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.