7

We've been asked to support some rather old Perl forms on a new site, as we're using a PHP based CMS we need to include the Perl scripts into our new CMS.

I've tried a bit of shell_exec but that's disabled. Has anyone got any ideas?

6
  • Why? If you have some URLs covered by Perl scripts why do you need those under cms control? Commented Jun 25, 2009 at 11:29
  • Good question, we have some contact forms which submit into a horrible database app, on this same page we need the client to be able to change the content though the CMS. If there were any way I could not use Perl, I'd be all over it :) Commented Jun 25, 2009 at 12:15
  • 1
    That means that the forms themselves aren't generated by those Perl scripts? Commented Jun 25, 2009 at 13:00
  • Unfortunately yes, perl is making the forms, creating a unique ID for the target URL (even if the form is submitted or not) Commented Jun 25, 2009 at 13:24
  • Then I don't see how a php cms could possibly control the contents of the forms. You will have to dig into the Perl, rip out the html and get that under cms control. Commented Jun 25, 2009 at 13:40

3 Answers 3

10

Perl extension

There is a Perl extension available for PHP.

An article from the Zend developer zone details it here.

The extension allows you to:

  • load and execute Perl files
  • evaluate Perl code
  • access Perl variables
  • call Perl functions
  • instantiate Perl objects
  • access properties of Perl objects
  • call methods of Perl objects

You can obtain it from CVS using this command:

$ cvs -d :pserver:cvs.php.net:/repository co pecl/perl

An example of running a Perl script is listed here:

Example 1 (test1.pl)

print "Hello from Perl! "

Example 1 (test1.php)

<?php
print "Hello from PHP! ";
$perl = new Perl();
$perl->require("test1.pl");
print "Bye! ";
?>
Sign up to request clarification or add additional context in comments.

1 Comment

Ah this looks like the perfect solution, except I'm not sure if we can load any extensions onto the hosting :(
0

If you Perl script is creating the page with the forms that you client is supposed to be able to change, then you are out of luck. You might be able to come up with some PHP page that contains the output of the Perl script, but you'll never be able to feed any changes on that page back into the Perl script.

Comments

-1

what about a php apache function virtual() ? http://php.net/manual/en/function.virtual.php I thing that combination of this and mod_rewrite is viable

1 Comment

To critique or request clarification from an author, please leave a comment below their post. Did you verify your proposed solution or do you only think that it might be working?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.