I am working on one project, where I am using mysql database with three tables: Requests, Responses, and Users.
The first (index) page is pure HTML where links are available. Those links will execute the Perl script to fetch data from the database and pass the data to a template file, so the next page will be generated.
My question is every time I need to fetch data from the MySQL database, do I need to open a connection with database, and after getting the query result close it again? How can I maintain a connection across queries so there is no need to reconnect to the database?
Can I have each and every query in a single Perl file in seperate functions? If so how to provide the link for Perl function?