perl in PHP

One of the projects that I am working on uses perl CGI scripts to do various things with a database and also getting information directly from routers and switches. One reason I did this in perl was because it was easier to port some of my existing commandline scripts to CGI.

The other reason was because I really did not want to use PHP to telnet to a router. I have seen the code that people use to do that, and it scares me.

So while poking around and researching what we would need to do to call perl scripts from php, in order to consolidate some of our development and get a little more speed... I ran across this link.

This has the potential to allow me to use perl for some of the things that I need, and php for the rest. I am pretty sure this is going to cause my coworker that is working on these projects with me, to go into a fit. :)

Next week I will test using Net::Telnet, Net::Netmask and Text::Diff from inside php... what's the worst that could happen?!

$perl = new Perl();
$perl->eval( 'use Net::Ping;' );
$ping = $perl->eval('Net::Ping->new');
foreach ( array( '', '' ) as $ip ) {
   if ( $ping->ping($ip) ) {
      echo "$ip is alive!\n";