Page 1 of 1
using a php class in perl
Posted: Wed May 11, 2005 8:11 am
by thomas777neo
Is it possible
If so, how the heck would you do it.
I have an encryption/decryption function in php using mcrypt. My perl version doesn't support the older mcrypt modules for it. So I couldn't convert the functions to perl, so I want to use it directly.
Posted: Wed May 11, 2005 10:32 am
by timvw
write the complete script in php, and then call it from perl with system/exec...
Posted: Thu May 12, 2005 3:18 am
by thomas777neo
So if I had a function in a class:
Code: Select all
class exampleClass
{
function example($exampleVar)
{
return trim($exampleVar);
}
}
How would I from your example, create the new object, then execute the function and return the value?
Apologies, if it is a stupid question (I see that it puts the command output into an array, I don't know what to do with it afterwards)
Posted: Thu May 12, 2005 3:35 pm
by timvw
could would look like (untested)
Code: Select all
require_once('example.class.php');
$example = new example;
$result = $example->example($argv[1]);
echo $result
Code: Select all
#!/usr/bin/perl -w
@result = `php-cli somescript.php somevalue`;
print $resultї0];