mojobozo has asked for the wisdom of the Perl Monks concerning the following question:
First, please forgive my absence. It's been almost 2 years since my last confession, er... post. As a result of this and not playing with perl in the mean time, I've forgotten a bit.
The question: I have this cgi script:
Works just as I want it, meaning it takes the html file I'm looking at and dumps it into the textarea. However, I want to grab just a portion of the file I'm reading from. I have <!-- Begin --> and <!-- End --> comments in the file and want to grab the stuff between them. I tried playing around a bit with the above script and these comment lines, but all I got was a blank textarea.
Can someone help me out?
Thanks!
The question: I have this cgi script:
#!/usr/bin/perl print "Content-type: text/html\n\n"; &print_return_page_top; if (open (FILENAME, "..//..//test//index.html")) { $line = <FILENAME>; while ($line ne "") { print "$line"; $line = <FILENAME>; } } else { print "Booger<br>"; } &print_return_page_bottom; ################################## sub print_return_page_top { print <<RETURN_PAGE_TOP; <HTML> <HEAD> <TITLE>Update Index</TITLE> </HEAD> <BODY> Type your changes in the box below and then press Submit: <BR> <FORM NAME="update-index" ACTION="update-index.cgi" METHOD="get"> <TEXTAREA ROWS="20" COLS="100" NAME="index-data"> RETURN_PAGE_TOP } ################################### ################################## sub print_return_page_bottom { print <<RETURN_PAGE_BOTTOM; </TEXTAREA> <BR> <INPUT TYPE="Submit" NAME="Submit" VALUE="Submit"> </FORM> </BODY> </HTML> RETURN_PAGE_BOTTOM } ###################################
Works just as I want it, meaning it takes the html file I'm looking at and dumps it into the textarea. However, I want to grab just a portion of the file I'm reading from. I have <!-- Begin --> and <!-- End --> comments in the file and want to grab the stuff between them. I tried playing around a bit with the above script and these comment lines, but all I got was a blank textarea.
Can someone help me out?
Thanks!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: file reading issues
by jdporter (Paladin) on Aug 03, 2005 at 18:47 UTC | |
by bofh_of_oz (Hermit) on Aug 03, 2005 at 19:35 UTC | |
by mojobozo (Monk) on Aug 03, 2005 at 19:10 UTC | |
Re: file reading issues
by sgifford (Prior) on Aug 03, 2005 at 20:45 UTC | |
Re: file reading issues
by dtr (Scribe) on Aug 03, 2005 at 20:08 UTC | |
Re: file reading issues
by kwaping (Priest) on Aug 03, 2005 at 18:45 UTC | |
by JediWizard (Deacon) on Aug 03, 2005 at 19:19 UTC | |
by kwaping (Priest) on Aug 03, 2005 at 19:36 UTC | |
by JediWizard (Deacon) on Aug 04, 2005 at 02:57 UTC | |
by kwaping (Priest) on Aug 04, 2005 at 15:08 UTC | |
by JediWizard (Deacon) on Aug 04, 2005 at 16:49 UTC | |
by anonymized user 468275 (Curate) on Aug 04, 2005 at 16:13 UTC | |
Re: file reading issues
by bofh_of_oz (Hermit) on Aug 03, 2005 at 19:13 UTC | |
Re: file reading issues
by mojobozo (Monk) on Aug 03, 2005 at 19:17 UTC | |
by kwaping (Priest) on Aug 03, 2005 at 19:39 UTC | |
Re: file reading issues
by wfsp (Abbot) on Aug 04, 2005 at 10:21 UTC |
Back to
Seekers of Perl Wisdom