Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Debugging Perl in bash environment?

Status
Not open for further replies.

giganet

ISP
Joined
Aug 29, 2006
Messages
4
Location
US
I have been thrown into managing my own leased dedicated server as of recent o:.

While installing perl scripts I have grown accustomed to debugging scripts as they error using SSH .
The problem I am faced with presently is on my new server I have setup the customer templates to allow shell access to the server in /bin/sh.

When I logo onto the server via SSH and attempt to run perl commands:
perl -x -w -T script.cgi
The server returns "bash: perl: command not found"

When I log into the server via SSH I am presented with the following line in SSH:
bash-3.00$

I am accustomed to:
[giganetwireless@erwin giganet]$

Could someone enlighten me in the proper commands and format be to debug my perl scripts?

Below is server information:
Plesk version psa v8.0.1_build80060727.19 os_FedoraCore 4
Operating system Linux 2.6.11-1.1369_FC4


Thank you for your help in this matter.

Kindest Regards
Pat Taylor
 
$ which perl

then use the path to perl for your script

eg, /usr/bin/perl fred.pl

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Thank you for your help Paul

I tried $which perl and received "bash: which: command not found"

THen I tried "bash-3.00$ bash -x -T -w /usr/bin/perl Dream.cgi"

and received the following error

bash: -w: invalid option

Am I doing this right?
 
Code:
[b]bash-3.00$[/b] /usr/bin/perl -wT Dream.cgi
Looks like which has been disabled
Could be worth your while to read up on setting up your login script

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Thank you Paul

So I need to learn about making changes to the login script for my web-server, this is what you are referring to correct?

 
I have switched from bash to sh in SSH once logged onto the server:

Once I try to debug with:
sh -x Dream.cgi

I receive the following errors from a script that worked fine on another Unix server last week, why am I seeing these errors which I am assuming is causing my app to 500?

+ '$'
Dream.cgi: line 83: $: command not found
+ = 1
Dream.cgi: line 83: =: command not found
+ = /var/Dream.cgi: line 90: =: command not found
+ = /var/Dream.cgi: line 91: =: command not found
+ = /var/Dream.cgi: line 92: =: command not found
+ = /var/Dream.cgi: line 93: =: command not found
+ = .5
Dream.cgi: line 94: =: command not found
+ = /var/Dream.cgi: line 95: =: command not found
+ = /var/Dream.cgi: line 96: =: command not found
Dream.cgi: line 98: syntax error near unexpected token `&'
Dream.cgi: line 98: `&require_supporting_libraries (__FILE__, __LINE__,'


Thank you for your assistance
 
you're passing your scrip to the OS Shell, not perl

The reasons for your 500 errors should be visible in your Apache Logs, most likely malformed headers or file permissions

HTH

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top