Gossamer Forum
Home : Products : DBMan : Installation :

Calling a subroutine from another database

Quote Reply
Calling a subroutine from another database
I've got 2 databases working nicely. I know that you can call a subroutine by using something like:
&html_footer;

What I need to do is call the &html_footer from my other database. Since they are both named the same, it always looks for the html_footer within it's current database.

I've tried:
$db_setup = 'database2';
&html_footer;
but it still goes to the default footer Frown

Any ideas ?
Quote Reply
Re: Calling a subroutine from another database In reply to
Copy the second footer in the second html.pl and call it 'sub_html_footer2', whenever you need it, call that sub with '&html_footer2'.
Seems quit simple, so maybe I misunderstood.

Goodluck.
------
Mart.
Quote Reply
Re: Calling a subroutine from another database In reply to
Well, I actually am using the &html_footer as an example.

What I really need, is to tell DBMan jump to another subroutine in a different file. Either that, or tell it to switch databases.

I know how to do ith with a URL link (db=database2), but a link is no good.

[This message has been edited by Katana Man (edited July 27, 1999).]
Quote Reply
Re: Calling a subroutine from another database In reply to
Thanks JPDeni, that does make sense. I could do that, but the script still stays on the same database.

After more thinking, what I need is to tell the script to switch databases. I can do this with a link, but I would like some code to do it instead. Code that would say:

"switch to xdatabase"
&run_this_routine
Quote Reply
Re: Calling a subroutine from another database In reply to
What I would suggest is that you have a separate file for the subroutines you want the databases to have in common. Then use a syntax like the "require" statement in the .cfg file to load that file into memory. Make any sense?


------------------
JPD





Quote Reply
Re: Calling a subroutine from another database In reply to
What are you trying to do, James?

------------------
JPD





Quote Reply
Re: Calling a subroutine from another database In reply to
A person creates an new user account in database2. Adds a record. Upon success, gets automatically switched to database1 to add a record.
Quote Reply
Re: Calling a subroutine from another database In reply to
You could use something like

print "Location: $db_script_url?db=database1&uid=$db_userid&add_form=1\n\n"

instead of sub html_add_success in the database2 html.pl file.


------------------
JPD





Quote Reply
Re: Calling a subroutine from another database In reply to
Oh man!! If I wasn't married, I'd kiss you right on the lips !! But we'll have to settle for a kiss on the cheek Smile
Quote Reply
Re: Calling a subroutine from another database In reply to
 Smile

You're welcome!!


------------------
JPD