> I'm relatively new to the ASP model, but I like what I've seen so far.
> My question is regarding connection to a DB. Where in the ASP
> file/model does the connect string go? Wouldn't putting it in the asp
> file make it visible to the client with view source? Or am I missing
> something?
The perl code is processed on the server side. A client only ever receives HTML code
or more correctly the _output_ of any perl code in
your file.
So if this is your real source file:
[demo.asp]
<html>
<p>Hello from HTML.
<% print "<p>Hello from Perl"; %>
</html>
The server will process this (i.e. Apache, mod_perl and Apache::ASP), and produce this
HTML:
<html>
<p>Hello from HTML.
<p>Hello from Perl
</html>
Much more interesting stuff is possible with this framework, like:
<p>Count from 1 to 10:
<? for ( $i = 1; $i <= 10; $i++ ) { %>
<p>This is <%= $i %>
<% } %>
Which will produce
<p>Count from 1 to 10:
<p>This is 1
<p>This is 2
<p>This is 3
<p>This is 4
(etc)
So thats Apache::ASP 101 but to answer your question about database passwords, you
_can_ put them in the actual .asp files but I
wouldn't personally recommend it as good practice.
A better solution is to put any database stuff in the global.asa file. You'll find
doco on that on the Apache::ASP site but in a nutshell it is
where you put reusable "global" functions for your asp pages. So I have something like:
sub getDatabaseConnection
{
return $theDatabase if ( defined( $globalDBH ));
$theDatabase = <connect to database here...>
return $theDatabase;
}
Even better is to setup the database to be authenticated some other way. With mysql
you can use the .my.cnf (is that the right filename?)
etc.
HTH
Ellers
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]