Displaying text file in browser - perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Displaying text file in browser - perl
# 1  
Old 12-11-2008
Displaying text file in browser - perl

I am having issue dispalying text file in browser using perl.

Here is my code:

Code:
#!/usr/bin/perl

print "content-type: text/html \n\n";

open (FH , "access.log") || die "Blah $!";
while (<FH>) {
  print $_ ;
}

I have correct permissions and everything. The weired thing is when I print inside CONSOLE , it works fine but when I try to run it from broswer (with proper read/execute) permissions it just displays WHITE page (nothing in it).

Can some perl expert shed some light ... much appreciated.

Here is content of my file (its basically squid log):

1221275639.716 6 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275640.770 6 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275641.792 7 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275642.827 6 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275643.869 7 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275644.896 7 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275645.948 7 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275646.970 6 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275648.029 7 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275649.064 7 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275650.100 6 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275651.241 6 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275652.274 7 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275653.328 7 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html

Any help is highly appreciated Smilie

thx.
# 2  
Old 12-11-2008
I am closing this thread. It is a duplicate of another thread by same user in this forum.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with text modification and displaying

I have a file storing some text and another file storing some numbers I want to display characters other than the specified place of strings one.txt xyz abc 233 skfo 4r443 sfs abc abcd sd fsdf sdfd abc 11 abc 33 abc dsaf two.txt Nt_djd_k='5-6,7-9' Nt_hh_l='3-6,7-8' a=`grep... (4 Replies)
Discussion started by: rahulsk
4 Replies

2. Shell Programming and Scripting

Displaying certain text in a msg.

I have a requirement to display a part of an html response that my application gets. The response looks like this: <html><a href='com.aprisma.spectrum.app.sd.client.SDHyperlinkHandler' sdTicketHandle='cr:419900' ocAlarmId='506618ea-f013-102d-02a7-0050569d7aa8'... (3 Replies)
Discussion started by: dlundwall
3 Replies

3. Shell Programming and Scripting

Displaying a number in binary using perl

printf FH2" 3'b%b : begin\n",$i; where i is an integer in the loop is displaying 3'b1 : begin expected output was 3'b001 : begin (1 Reply)
Discussion started by: dll_fpga
1 Replies

4. Web Development

Too long in displaying the data in a Web Browser

this is my another one question as well as my sample program. Because of the big data the gets from the database.,it takes time to display the output in a web browser.,is there any way to display the output as faster as it can..?my time is wasting because of too long to display.:confused: ... (3 Replies)
Discussion started by: Jeneca
3 Replies

5. Shell Programming and Scripting

Displaying Result to a Text File

Hi; I am scripting in Shell and i want to write output (on screen) to a text file? ... | tee gcsw/output.txt doesnot work? :(:( (6 Replies)
Discussion started by: gc_sw
6 Replies

6. UNIX for Dummies Questions & Answers

How can I append a text at end of file after displaying the file

I have a file "sample.txt" with the content as below: Hi This is a Sample Text. I need a single command using cat which serve the following purpose. 1.display the contents of sample.txt 2.append some text to it 3. and then exit But, all should be served by a sinle command.:confused: (1 Reply)
Discussion started by: g.ashok
1 Replies

7. UNIX for Dummies Questions & Answers

Displaying Text

Hi guys! I am very much new to UNIX...and I was just wondering on how you would display this text format in UNIX with only just one command : Text 1 Text 2 Text 3 Texts are in aligned vertically in such format...Thanks for your help :) (8 Replies)
Discussion started by: Knowledge_Xfer
8 Replies

8. Shell Programming and Scripting

Displaying text file in browser - perl

Don't know why this didn't get posted before but... I am having issues displaying a log file in the browser using perl and I can't get it to display at all, All i get is WHITE (blank page). I have proper permissions in my cgi-bin directory and everywhere else. So I know that's NOT the issue. ... (3 Replies)
Discussion started by: Dabheeruz
3 Replies

9. UNIX for Advanced & Expert Users

script to open the specified url in a browser from a text file

Hi All, here i am struc (6 Replies)
Discussion started by: gsp
6 Replies

10. UNIX for Dummies Questions & Answers

Text-based internet browser?

Dear all, I can only use text-based terminal, x-window is not support my session. Do anyone know have any text-based Internet browser in Sparc sun? Regards Wilson (2 Replies)
Discussion started by: wilsonchan1000
2 Replies
Login or Register to Ask a Question