I have a drupal site with the webform module, the user fills out a form on the website and the data goes into the database. Then some back end perl queries the database and processes the data entered, the users then get an e-mail with results.

I would like to enhance the application by closer integrating the back end perl code and drupal. What I need is the user to submit the form, then immediately drupal kicks off perl to crunch the data and on the confirmation page present the user with the output of the process, allow the user to confirm the submission and then kick off another perl script.

I do not have any programming experience outside of intermediate perl, but am willing to learn a few things to get this done.

What are some of my options?

Thanks in advance


I wanted to provide some more clarity.

I am basically looking to capture the output of perl in a better format. I can configure the confirmation page for the form to run code that runs the processing, then invoke a second webform with URL based parameters for field population. Theoretically this should work, but there is a large difference between theory and practice. What do you guys think? Is there a better way to pass arguments to the second form?

Drupal is run on PHP , not Perl.

Our newest Drupal site: PacificAikido.com (Drupal showcase)

Right, I get that, but the data processing is written in perl and I can run system commands from php.
I have the perl script called from a drupal page, however I can't get multiline perl output to print in php for some reason. So I am trying to url encode the string coming out of perl. It works fine on the perl side, but there seems to be no way for me to decode it in drupal. The specific data I get are URI parameters to prepopulate the destination form.

The problem is that the drupal_goto function accepts only an array, a string doesn't go in. I also can't construct the entire URL and pass it to drupal_goto because it doesn't get encoded properly by that function. So.... I guess I will need to build out the array in php to accept the values and then have to pass that. Why I can't pass the exact url I want to go to is beyond me. I can easily take the output from the perl script and copy and paste it after ?q=node/17& and it works perfectly.

1) I don't understand why you are doing any of this with Perl. Everything you have described can be done in Drupal and does not require an external script at all.
2) drupal_got() does accept a string, however if you want to and queries or fragments to your drupal_goto() function, you will need to pass an array() using the format of the url() function.
3) To be honest, I'm not sure what you are trying to ask. I think you are asking how to better integrate Perl and Drupal, but to be honest, it doesn't really make sense to use an external script to do things that Drupal can do, as it bypasses Drupal APIs, and creates a disjointed system. I'd recommend you learn how to do the things you want (such as sending emails) through Drupal, so that you can utilize Drupal's APIs. Otherwise it doesn't even really make sense to use Drupal. However if you really want to use Drupal in a non-Drupal way (IE doing Drupal things in external scripts), then you are likely on your own, as most people will not be going it that way, they will be doing it the Drupal way.

Our newest Drupal site: PacificAikido.com (Drupal showcase)

Hi Jaypan,

Thanks for the feedback. The perl script actually does significantly more, it doesn't just create the url, there is some significant data massaging going on under the hood. The only thing that I want to do is take the output data and show it in a form in drupal. Perl even constructs the URL parameters, so drupal's job here is very straightforward.
I have a php drupal page that has the following php code, that shows what I essentially want to do:

drupal_goto ('node/17',$result)

The output from perl looks something like this

If on my php page I do a print $result; I will get this URL string, I can then paste it in URL decoder and it decodes fine. I can also copy it into the URL, change the form and the data loads. I just need to set up this quick redirect.

Keep in mind that the body data is several lines and just printing result from perl only prints the last line (i.e. so that is why constructing a php array in perl and then exporting it as a string doesn't work).

Thanks in advance

I understand, but I don't see why you would be doing your processing in Perl rather than in Drupal.

Our newest Drupal site: PacificAikido.com (Drupal showcase)


The code is already written; now that you are better familiar with the issue, can you recommend a workaround or a solution?


I got it. Just set the location in the header, used this part from drupal_goto
header('Location: ' . $url, TRUE, $http_response_code);
works awesome