How can I use Perl libraries from PHP?

embed, perl, php

Solution

You could also use PHP::Interpreter from CPAN. This allows you to embed a PHP interpreter in Perl and also, more usefully for you, to create a Perl object in PHP:

<?php
    $perl = Perl::getInstance();
    $fh = $perl->new("IO::File", "<$file");
    while($fh->getline()) {
      # ...
    }
  ?>

Problem

I want to use Perl libraries from a PHP application. I have heard that it is possible. I have considered the possibility of re-writing the libraries in PHP, but I do not think that is a good idea because it is difficult.

Original source