Greetings,
Quite simply put - I have a little library of commonly used subs which I
would like to require at the top of each page.. so I have:
[.-
use POSIX qw(ctime);
require "/opt/sage/lib/sagelib.pl";
$rv = selectall_dialin_account( $fdat{directory_id} );
-]
In on a page ( the fdat stuff is defined and all is well) - in sagelib, I
have:
sub selectall_dialin_account {
use DBI;
my ( $directory_id ) = @_;
$sage_dbh = DBI->connect( "DBI:Pg:dbname=sage;host=localhost",
username, password ) or die "Error:" . $DBI::errstr . "\n";
$sth = $sage_dbh->prepare("select
directory_id,username,password,encryptedpassword,account_type,checkattr,replyattr,created_by,record_created,record_modified
from dialin_account_data where directory_id='$directory_id'") or die
"Error:" . $DBI::errstr . "\n";
$numrows = $sth->execute or die "Error:" . $DBI::errstr . "\n";
if ( $numrows > 0 ) {
return $sth;
}
else {
return;
}
1;
In theory this should happily work right? I.e. a non-embperl script from
the command-line - the above happily returns a ref...
Although using a browser etc - it keeps whinging at me:
Error in Perl code: Undefined subroutine
&HTML::Embperl::DOC::_1::selectall_dialin_account called at
/opt/apache/htdocs/admin/services/dialin/select.epl line 14.
Any help would be copiously appreciated. :)
//umar.
Quite simply put - I have a little library of commonly used subs which I
would like to require at the top of each page.. so I have:
[.-
use POSIX qw(ctime);
require "/opt/sage/lib/sagelib.pl";
$rv = selectall_dialin_account( $fdat{directory_id} );
-]
In on a page ( the fdat stuff is defined and all is well) - in sagelib, I
have:
sub selectall_dialin_account {
use DBI;
my ( $directory_id ) = @_;
$sage_dbh = DBI->connect( "DBI:Pg:dbname=sage;host=localhost",
username, password ) or die "Error:" . $DBI::errstr . "\n";
$sth = $sage_dbh->prepare("select
directory_id,username,password,encryptedpassword,account_type,checkattr,replyattr,created_by,record_created,record_modified
from dialin_account_data where directory_id='$directory_id'") or die
"Error:" . $DBI::errstr . "\n";
$numrows = $sth->execute or die "Error:" . $DBI::errstr . "\n";
if ( $numrows > 0 ) {
return $sth;
}
else {
return;
}
1;
In theory this should happily work right? I.e. a non-embperl script from
the command-line - the above happily returns a ref...
Although using a browser etc - it keeps whinging at me:
Error in Perl code: Undefined subroutine
&HTML::Embperl::DOC::_1::selectall_dialin_account called at
/opt/apache/htdocs/admin/services/dialin/select.epl line 14.
Any help would be copiously appreciated. :)
//umar.