PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: David Hojo Hajoglou <hojo at dns dot asksimon dot com>
Subject: DBlib works in script/not in mod
Date: Apr 13 2000 8:38PM

for some reason, hopefully a simple and fixable one, I can connect to the
database from a script, but when I wrtie the same code into a mod, the
$dbh is not created.  The code is straight forward and the handler is
part of a  directive



SetHandler "perl-script"
PerlHandler isoft::twigauth



================
package isoft::twigauth;

use strict;
use Apache::Constants qw(:common);
use Apache::Log();
use Sybase::DBlib;

sub handler{

        my $r = shift;
        my $dbh = undef;
        my $i;

        $dbh = Sybase::DBlib->dblogin('sa','','ISOFT',"$$");

        my @data = $dbh->nsql("select * from sysprocesses",[]);
                for ($i=0; $i <= $#data; $i++){

                        $r->log->info("\n$data[$i][5]");
                }
	return  FORBIDDEN; #just to apease the client
}
1;

When run in a script, the code executes and I get a return from the DB.
When run as a module, the dbh never gets created and the
following error occurs:

DB-Library error:

[Thu Apr 13 14:29:35 2000] [error] Can't call method "nsql" on an
undefined value at /usr/lib/perl5/site_perl/5.005/isoft/tw
igauth.pm line 16.

Is there anything I am missing?

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
David Hajoglou   "Hojo" --UNC Delta U. 1998--
Director of Voice and Data Communications/Linux Sys. Admin.
iSoft Corp.	Phone: 1.303.539.0513 x202	Fax: .0512
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
c:\winnt> secure_nt.exe
  Securing NT.  Insert Linux boot disk to continue......