Hello and welcome to the Webmasters Forums!. This is the best place to get webmasters resources for free. Get $2 for free today, read more - Make your payment today. Download premium and professional templates for free. Get free web hosting without ads, read more. You can get lot more by simply join with this forum. To gain full access to the forums you must sign up for a free account.


Post Reply  Post Thread 

Testing Perl Programs

Post Bank
Posting Manager
******

Posts: 995
Group: Forum Team
Joined: Sep 2006
Status: Online
Make money from now. You can make money just for posting on this forum. Every discussions on this community gives you more money. $2 minimum payout. So get your payment today, SignIn with this forum.

Signin to Remove this Post

bomber
Junior Member
*


Posts: 34
Group: Registered
Joined: Sep 2006
Status: Offline
Reputation: 0
Points: 250 (Donate)
Post: #1

Smile Testing Perl Programs


Use the compiler -w switch to warn about identifiers that are referenced only once, uninitialized scalars, redefined subroutines, undefined file handles, probable confusion of "==" and "eq", and other things. This can be coded in the magic cookie first line:

#!/usr/local/bin/perl -w

As you write your program, put in print statements to display variables as you proceed. Comment "#" them out when you feel you don't need to see their output.

CGI scripts require some special attention in testing.

MU's "showme" and "SGI" Web servers (http://www.missouri.edu and http://www.cclabs.missouri.edu) use the Apache "sucgi" facility. This causes CGI programs stored under your directory ~/www/ with file name ending ".cgi" to execute as your own ID. On some other Web server the script does not execute under your login ID! It executes under the ID of the Web server, typically as user "nobody".

Thus a script that works at the command line may fail under the Web server because:

# The path for executables or Perl library might be inappropriate. Print $ENV{'PATH'} and @INC to see if there's a difference. Fix it with Perl statements like:

$ENV{'PATH'} .= ':~myid/bin:~myid/cgibin';
push @INC,'~myid/lib/perl';

# File permissions give your ID access don't give the Web server appropriate access.

19-09-2006 12:39 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Simplest Perl CGI geekyone 1 222 15-04-2008 04:31 PM
Last Post: ivenms
  MySQL with Perl maddog39 4 618 09-08-2007 07:04 AM
Last Post: walsh
Smile Storing and Running Perl Programs bomber 0 673 19-09-2006 12:13 AM
Last Post: bomber
Smile Taste of Perl bomber 0 656 19-09-2006 12:11 AM
Last Post: bomber
Smile State of Perl bomber 0 673 19-09-2006 12:09 AM
Last Post: bomber
Smile What Is Perl? bomber 0 633 19-09-2006 12:07 AM
Last Post: bomber

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites
Rate This Thread:

Forum Jump:

Sign In to Remove Ads

Download 1000's of web templates. Unlimited access!
World's Best Web Hosting
Website of the Month

Create-a-Page for Free
SOTM June 2008


Accepting Submissions
for July 2008
Resources

Recommended Sites:



Visit our Sponsors!

Current time: 30-08-2008, 10:14 PM


Copyright © 2002-2008 MyBB Group
Powered By MyBB