473,748 Members | 2,353 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

tie::File 500 Internal Server Error???

35 New Member
Hi folks,

Perl is always killing me. I always do it on my computer first and then upload to the server in our lab. And oh my, never ever be correct to run on the lab. This time I got the internal error. I tried to add and delete multiple lines and found out that is possibly due to tie::File.

Could you please help me to solve the problem? I am dying for it :(

Here's the code.
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl 
  2.  
  3. #use CGI::Carp qw(fatalsToBrowser); 
  4.  
  5. #use strict; 
  6.  
  7. use CGI; 
  8.  
  9. use Tie::File; 
  10.  
  11. $query = new CGI; 
  12.  
  13. $data_file="nameList.cgi"; 
  14.  
  15. open(DAT, $data_file) || die("Could not open file!"); 
  16.  
  17. @raw_data=<DAT>; 
  18.  
  19. tie @line, 'Tie::File', $data_file or die("Could not open file!"); 
  20.  
  21. print $query->header(); 
  22.  
  23. print "Content-type: text/html\n\n"; 
  24.  
  25. print "<HTML><HEAD>\n"; 
  26. print "<TITLE>Thanks!</TITLE></HEAD>\n"; 
  27. print "<BODY>"; 
  28.  
  29. $first = $query->param("first"); 
  30. $last = $query->param("last"); 
  31. $email = $query->param("email"); 
  32.  
  33.  
  34.  
  35. print "<P>$first $last, thank you for signing up! Please click <a href=\"list.pl\">here</a> to see the signup table for confirmation and don't repeatly signing up.</P>\n"; 
  36.  
  37.  
  38.  
  39. $count = 0; 
  40.  
  41. @WS = $query->param("ws"); 
  42.  
  43. foreach $ws(@WS){ 
  44.  
  45. $line[$ws-1].="$first $last, $email|"; 
  46.  
  47.  
  48. close(DAT); 
  49.  
  50. print "</BODY>\n"; 
  51.  
  52. print "</HTML>\n"; 
  53.  
-------------------------------------------------------------------------------------------------------

And I've tried use warnings, add and remove -w.....doesn't work.........cr ying T-T

Cannot appreciate more.
Oct 25 '07
20 2097
KevinADC
4,059 Recognized Expert Specialist
I don't think the problem is with Tie::File. If you are running the script via a web server and getting a 500 internal server error the script may not even be compiling. Could be the path to perl is wrong or the scripts permissions are wrong or you uploaded the script in binary mode instead of text mode. If the problem was with Tie::File the CGI::Carp module should be printing an error to the screen. Any idea what version of perl you are using? Can you get any CGI scripts to work?
Oct 25 '07 #11
casybay
35 New Member
Yes, I can run other perl script which doesn't have that tie::File.
And I finally get my error log, here is the related error:

Can't locate Tie/File.pm in @INC (@INC contains: /usr/perl5/5.00503/sun4-solaris /usr/perl5/5.00503 /usr/perl5/site_perl/5.005/sun4-solaris /usr/perl5/site_perl/5.005 .) at /spare/WWW/cgi-bin/list.pl line 5.
BEGIN failed--compilation aborted at /spare/WWW/cgi-bin/list.pl line 5.
Oct 25 '07 #12
KevinADC
4,059 Recognized Expert Specialist
The problem is you are running a very old version of perl. Tie::File is not installed. I do not know if it will even work with such an old version of perl (5.005) . That mst be at least 10 years old. So for know you can't use Tie::File.
Oct 25 '07 #13
casybay
35 New Member
10 years old??? Oh my, yea....I searched on internet, saying that I missed a module, and I can add it to the makefile.pl. Hum....then I should let the website adminstrator to fix up that first. Thank you so much.
Oct 26 '07 #14
casybay
35 New Member
The module is installed, but I still get another error. Can anyone help??? Than.........ks !!!
Error:
Premature end of script headers:
Oct 26 '07 #15
KevinADC
4,059 Recognized Expert Specialist
The script I posted for you should not generate that error message unless the path to perl is wrong or you uploaded the script in binary mode instead of text mode. It looks like Tie::File will work with perl 5.005.
Oct 26 '07 #16
casybay
35 New Member
KevinADC, yes, I did use WS_FTP32 binary mode to upload the file, but seems other pl files are ok, only the file I am working on has problem T_T And this FTP program has twp options: ASCII and binary.
Oct 30 '07 #17
KevinADC
4,059 Recognized Expert Specialist
Try uploading in ASCII mode which is text mode. If that does not work, I am not sure what the problem is unless the path to perl is wrong.
Oct 30 '07 #18
casybay
35 New Member
I tried, and it is wierd. When I upload it in binary mode, I got the errror"prematur e end of script headers". And when I uploaded it in ASCII mode, I got "Can't locate warnings.pm in @INC " again. But our web administrator had already install the Tie module. Oh, my, this seems like endless. I really really appreciate your help, KevinADC.
Oct 30 '07 #19
KevinADC
4,059 Recognized Expert Specialist
The problem has to be the very old version of perl you are using. You are trying to write modern code using an outdated version of perl. Evidently the warnings pragma is not included with that version of perl:

use warnings;

remove that and use the -w switch on the shebang line:

#!/usr/bin/perl -w

but the best solution is use a newer version of perl. You will continue to have problems and you will just get frustrated. Ask the tech guys to upgrade perl if at all possible.
Oct 30 '07 #20

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1689
by: Jonathan Weekes | last post by:
Being utterly a non Perl IT guy, I have to write a Perl script for a web site to edit a line in a file. I have looked on Google and found Tie to be what I needed, but I am really lost in how to change the line. Can someone please edit the script below for me to show me how to do this? I have already looked in the documentation and still got lost... use CGI qw/:standard/; use CGI::Cookie; use Tie::File;
1
2548
by: SpecialK | last post by:
Does anyone know how to tie a large file to a hash without using shared memory? I know I can use Tie::File to tie the file to an array and from the array create a hash, but I need something that is much faster than that? thanks, gregk
2
1216
by: steventhrasher42 | last post by:
I very likely may be missing something here, but what stops a user from holding down the F5 key in their browser and generating hundreds of requests to IIS and thus tying up server resources? If session state is enabled (enableSessionState=true), all of these requests get queued and processed one after another. And if the user finds a particular page with poor enough performance, say one that takes a few seconds to render, by holding...
2
15993
by: kelly | last post by:
Hi, I don't have a code to show you, what I need are references or algorithms so that I'm in a right track. By the way, thanks for introducing me the array or arrays. Now I can continue my script. Now I want to delete a line from a file. Line being the strings I got/saved to/from array of arrays.
5
1495
by: mich dobelman | last post by:
I am developing a web crawler which collects info from more than 50,0000 pages. but i am afraid this is going to clog the rental web server if I run it every single day. Is it possible to stop the web hosting server because of my program? MD
1
1987
by: jonathan184 | last post by:
trying to rename filenames and extensions then add a header in line1 of each file if the header existed in line 1 to go to the next file. but i am getting error explciti errors Here is my code I am using #!/usr/bin/perl user warnings;
1
3097
by: J. J. Ramsey | last post by:
In Perl, there is a module called "Tie::File". What it does is tie a list to each line of a file. Change the list, and the file is automatically changed, and on top of this, only the bits of the file that need to be changed are written to disk. At least, that's the general idea. I was wondering if something roughly similar could be done in Python, or at the very least, if I can avoid doing what amounts to reading the whole file into...
2
12328
by: eMko | last post by:
Hello, In Perl, using a Tie::File module I can easily and comfortably delete a line from the middle of a text file: my @file; open(DATA, "+<:encoding(utf8):raw" , "file.txt") or return 0; tie @file, 'Tie::File', \*DATA or return 0; splice(@file, $_, 1); untie @file;
1
47476
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or “save“. I’m going to show you how to do that using a perl script. What You Need Any recent...
0
8831
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9326
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8245
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6076
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4877
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3315
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.