Click to See Complete Forum and Search --> : Calling perl subroutines from html href


soltenviva
07-18-2006, 11:48 AM
This may be a dumb question but any help would be appreciated.

I am writing a perl script to display an SQL database but I only want to display a certain no. of entries per screen i.e. with links to go forwards and backwards within the database.

Is it possible to call a subroutine within my script from <a href="/cgi/put the sub name in here">View next five records</a>? Or can I only call another html file or cgi script from there? Or is there syntax to refer to a subroutine directly from the href?

Thanks!

PineSolPirate
07-18-2006, 04:45 PM
All of the code in Perl is interpreted entirely on the server before being given to the browser. That means you can't call bits of perl like that. You can however call a refresh of the script with the addition of a GET variable (e.g. page.cgi?thisthing=avalue) that can trigger that subroutine.

soltenviva
07-18-2006, 05:17 PM
Thanks! That's definitely helped me especially rethinking the concept of where the processing takes place (i.e. client or server side). Thanks again, PineSolPirate!