Gossamer Forum
Home : General : Perl Programming :

Calling DBMan within DBMan

Quote Reply
Calling DBMan within DBMan
This is another chapter in the SSI book: if my question has already an answer will someone please redirect me to the right thread? If there is any, I couldn't find it.
I need to include a DBMan call in the HTML.PL file. I did this:
sub sti {
open (FILE, "/home2/smart/public_html/millennio/cgi-bin/dbman/millennio.cgi") or die("Can't find.");
@lines = <FILE>;
close(FILE);
foreach $line (@lines) {
print $line;
}
}

This is working, however it prints out the whole CGI script if in the HTML.PL I write

&sti;

This is not the problem, however. If I include parameters after the script and execute it (millennio.cgi?db=users&uid=&view_records=1&ID=*) I get a file not found error. Any suggestion?

Quote Reply
Re: Calling DBMan within DBMan In reply to
Of course it's printing out the entire script, thats what you are telling it to do.

If you are trying to execute a certain routine in millennio.cgi, then just do:

require "millennio.cgi";
&whatever_routine_you_need;

your variable (paramaters) should be in tact when the subrouitine in millennio.cgi executes, provided they have been set before the routine call.

Also, the reason you are getting the file not found when using params is because opening a file in perl doesnt use http protocal. (or url). So, when you provide those chars, perl thinks it's part of the filename. Since no file by that name exists, file is not found.
--mark

[This message has been edited by Mark Badolato (edited February 07, 2000).]