Re: How to display a Text file using web browser under CGI

2004-08-14 Thread Bryan Harris


Or how about this?

use File::Copy;
print "\n\n";
copy "myfile.txt", \*STDOUT;
print "\n\n";

- B


> Hello!
> 
> An example would look like this:
> 
> #!/usr/bin/perl -w
> use strict;
> use CGI qw(:standard);
> 
> my $file_loc = "bla";
> my @file;
> 
> if (open(FILE, $file_loc)) {
>   @file = ;
>   print header;
>   print start_html();
>   print "@file";
>   close (FILE);
>   print end_html();
> } else {
>   print header;
>   print start_html();
>   print "Cant open file: $file_loc";
>   print end_html();
> }
> 
> Hope it works ;)
> 
> Luka
> 
>> 
>> Od: "Sun, Jian" <[EMAIL PROTECTED]>
>> Datum: 2004/08/10 Tor PM 10:52:05 GMT+02:00
>> Za: <[EMAIL PROTECTED]>
>> Cc: <[EMAIL PROTECTED]>
>> Zadeva: How to display a Text file using web browser under CGI
>> 
>> Dear all;
>> Could anybody help me to figure out How to display a Text file using the
>> web browser in a CGI program?
>>  
>> Thanks in advance
>> Jian
>> 
>> --
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>> 
>> 
>> 
> 
> =
> Mirko tipka na radirko.
> http://www.worldofspectrum.org/
> =
> 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




re: How to display a Text file using web browser under CGI

2004-08-14 Thread lfurlan
Hello!

An example would look like this:

#!/usr/bin/perl -w
use strict;
use CGI qw(:standard);

my $file_loc = "bla";
my @file;

if (open(FILE, $file_loc)) {
  @file = ;
  print header;
  print start_html();
  print "@file";
  close (FILE);
  print end_html();
} else {
  print header;
  print start_html();
  print "Cant open file: $file_loc";
  print end_html();
}

Hope it works ;)

Luka

> 
> Od: "Sun, Jian" <[EMAIL PROTECTED]>
> Datum: 2004/08/10 Tor PM 10:52:05 GMT+02:00
> Za: <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Zadeva: How to display a Text file using web browser under CGI
> 
> Dear all;
> Could anybody help me to figure out How to display a Text file using the web 
> browser in a CGI program?
>  
> Thanks in advance
> Jian
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
> 
> 
> 

=
Mirko tipka na radirko.  
http://www.worldofspectrum.org/  
=


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: How to display a Text file using web browser under CGI

2004-08-13 Thread Jan Eden
Hi Jian,

Sun, Jian wrote on 10.08.2004:

>Dear all;
>Could anybody help me to figure out How to display a Text file using the web 
>browser in a CGI program?
> 
>Thanks in advance
>Jian
>

Try this:

#!/usr/bin/perl -wT

use strict;
use CGI;

my $q = new CGI;

print $q->header(-type=>'text/html');
open (FILE, "filename_goes_here");
while () {
print $_, "";
}

As before, you are encouraged to get Learning Perl, Programming Perl and CGI 
Programming with Perl from O'Reilly.

- Jan
-- 
There are 10 kinds of people:  those who understand binary, and those who don't

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: How to display a Text file using web browser under CGI

2004-08-13 Thread David Dorward
On 10 Aug 2004, at 21:52, Sun, Jian wrote:
Could anybody help me to figure out How to display a Text file 
using the web browser in a CGI program?
* output suitable http headers such as the content type
* open the file
* read the file
* output the file
Where are you having difficulty?
--
David Dorward
 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



How to display a Text file using web browser under CGI

2004-08-13 Thread Sun, Jian
Dear all;
Could anybody help me to figure out How to display a Text file using the web 
browser in a CGI program?
 
Thanks in advance
Jian

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]