Jump to content

Accessing Perl through PHP


suttercain

Recommended Posts

Hi Guys,

 

I am attempting to access my first Perl script so I can then attempt a module.

 

I have no idea how to do this and google yileds very little help. The closest thing I found was this article:

http://devzone.zend.com/node/view/id/1712

 

Right now I am attempting to access the perl directory on my shared hosting account:

<?php require('/usr/local/bin/perl'); ?>

 

When I ran this, the following error was echoed:

 

Warning: Unexpected character in input: '' (ASCII=15) state=1 in /usr/bin/perl on line 957

 

Warning: Unexpected character in input: '' (ASCII=3) state=1 in /usr/bin/perl on line 957

 

Parse error: syntax error, unexpected '{' in /usr/bin/perl on line 957

 

Anyone know how to connect to Perl then attempt to run a module? The module I need is already installed on the host, I just need to know how to access it.

 

Thanks.

Link to comment
Share on other sites

Thanks Thorpe,

 

That seems to be getting me on the right path. I ran this:

exec('/usr/bin/perl/sample/dmpExR.pl');

and I got a blank white page, which is better that the errors.

 

Does anyone know how to actually run a specific module? The module, Spreadsheet::ParseExcel,  is installed on my shared server and the module information is here:

http://search.cpan.org/dist/Spreadsheet-ParseExcel/lib/Spreadsheet/ParseExcel.pm

 

A link to a tutorial or demo would be great... I have numerous books on PHP and not one shows me how to run a perl module via PHP.

 

Thanks.

Link to comment
Share on other sites

The perl command line interpretor has several options for running code directly on the command line, but yeah... as has been pointed out, your question has now become that of a perl one.

 

I've shown you how to access the perl interpretor, if you can't get it to do what you want, you need perl help.

 

If your on linux type....

 

info perldoc

 

Otherwise Id'e suggest taking a look at http://perldoc.perl.org

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.