Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8071891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:50:09+00:00 2026-06-05T13:50:09+00:00

I am working with Perl/CGI, MySQL, Perl Template toolkit. I have a database set

  • 0

I am working with Perl/CGI, MySQL, Perl Template toolkit.

I have a database set up and some perl modules to query the database.

From the perl modules I pass on a datastructure (hash of hashes) to perl template toolkit (.tt) and that renders the results on the webpage.

I would now like to add an option of downloading the search results into a tab delimited file; i.e. provide a download file option. I have a subroutine in my perl module to do the conversion into tab-seperated format. I want to be able to call that subroutine
to convert the search results into tab-seperated format. Can I call a subroutine from a perl module in Template toolkit?

I am trying to figure out how to generate a downloadable file without again querying the database or without storing the results in CACHE.

Is there a way to pass the datastructure(hash of hashes) that Perl template is rendering, to a Javascript (that further calls subroutine) that can then generate a downloadble file?

Please suggest a correct approach.

Thanks for your time

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T13:50:10+00:00Added an answer on June 5, 2026 at 1:50 pm

    Can I call a subroutine from a perl module in Template toolkit?

    You can, but it doesn’t make sense to for this problem.

    You don’t need any templating capabilities, and you do need a different Content-Type header. Don’t use TT when the tab separated file is being created.

    I am trying to figure out how to generate a downloadable file without again querying the database or without storing the results in CACHE.

    There is no reasonable way to do that. The closest you could get would be to parse the data out of the generated (by TT) HTML document with JavaScript (not using the Perl you wrote to generate the tab separated file), and then build the tab separated file on the client, and make it available for download.

    It would be simpler, easier and more reliable to just hit the database again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a Perl CGI script which fetches an html page from a
I have a Perl CGI script that isn't working and I don't know how
I'm working on a Perl script where the user adds a number of set
Good Day, I have a simple working routine in Perl that swaps two words:
I've moved a Perl CGI app from one web host to another. Everything's running
I have a working perl script that grabs the data I need and displays
Perl newbie here...I had help with this working perl script with some HASH code
I am relatively new to Perl.I have been trying to insert data to database
I'm working on a homework assignment in Perl CGI using the CGI.pm module. In
I'm working on a Perl script which is called from a server side include

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.