|
From: shane <sh...@lo...> - 2006-05-05 00:03:15
|
Ok all you slashcode-devel guru's, I'm stuck, and looking for some
advice.
I'm trying to write a plugin that will let a slash site reach a MS
SQL2k server through DBI::Sybase.
*Note*: this is a plugin. It's not intended to let an entire slash
site be back-ended by MS SQL2k!! Instead, the thought behind this is
the plugin's DB code could eventually use Slash's standard sqlSelect
{...} to grab from the sql2k server.
in htdocs/test.pl I've got
my $osba_reader = getObject('Slash::OSBA', { db_type => 'mssql'});
it returns
$VAR1 = bless( {
'_dbh' => bless( {}, 'DBIx::Password' ),
'virtual_user' => 'sqlprod'
}, 'Slash::OSBA' );
because I have an entry in the db's table for it:
mysql> select * from dbs;
+----+--------------+---------+-------+--------+---------------+
| id | virtual_user | isalive | type | weight | weight_adjust |
+----+--------------+---------+-------+--------+---------------+
| 2 | sqlprod | yes | mssql | 1 | 1 |
+----+--------------+---------+-------+--------+---------------+
1 row in set (0.02 sec)
In Slash::OSBA::DB::mssql::mssql.pm
I have a very simple function:
sub getFromTest {
my ($self) = @_;
return $self->sqlSelectAllHashrefArray("*", "test");
}
so when I run test.pl from the command line:
(this is basically the code it's running)
my $osba_reader = getObject('Slash::OSBA', { db_type => 'mssql'});
print Dumper($osba_reader);
my $setthedb = $osba_reader->sqlDo("use testdatabase");
my $data = $osba_reader->getFromTest();
print Dumper($data);
here's the output (less the first Dumper)
$VAR1 = [
{
'value' => 'foo',
'id' => 1
},
{
'value' => 'two',
'id' => 2
},
{
'value' => 'three',
'id' => 3
}
];
which the data's correct. So I know the plugin can successfully read
data from the table 'test' on the MS SQL2k server via it's database
'testdatabase'.
However, when I hit that test.pl via a browser, weird things happen.
It's as if the .pl mime type being sent from httpd is screwy, because
the browser wants to download the src of the script.
The sourcecode to the perl script I'm hitting with the browser is here:
http://lottadot.com/files/test.txt
If I telnet to the machine's port and try a GET by hand I do not get
anything returned other then
"Connection closed by foreign host."
Any thoughts on this? I'm confused why it works fine via the CLI but
via Apache it dies. Am I misusing what getObject was intended for?
I'm stumped.
Thanks,
Shane
|