Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Dynamically alter shtml file

by punch_card_don (Curate)
on Apr 04, 2009 at 15:47 UTC ( [id://755448]=perlquestion: print w/replies, xml ) Need Help??

punch_card_don has asked for the wisdom of the Perl Monks concerning the following question:

Multifarious Monks,

My in-house search engine returns result links like this:

http://www.mydomain.com/cgi-bin/my_highlighter_script.pl?url=url_to_retrieved_file/file_name.htm&keyword=my_keyword

my_highlighter_script.pl gets the file, scans it for the keyword, and inserts markup to highlight the word, and outputs the file line by line. Works like a charm for html files.

But - now I have some shtml files to deal with. Clearly, having my_highlighter_script.pl output the file line by line is going to circumvent the SSI.

How can I dynamically alter the contents of an shtml file and still get the SSI functionality?

Thanks




Time flies like an arrow. Fruit flies like a banana.

Replies are listed 'Best First'.
Re: Dynamically alter shtml file
by linuxer (Curate) on Apr 04, 2009 at 15:53 UTC

    How do you "get the file"?

    Don't you get the shtml files via HTTP? If you would do so, they should be already processed and your highlighter can work through the resulting html code.

      No, I've been just reading them in directly:
      open(FILE, $file); @LINES = <FILE>; close(FILE);
      Get 'em via HTTP - of course - perfect. Thanks.
        use LWP::Simple; $content = get $page_url; #and if you want, @LINES = split(/\n/, $content);
        Works like a charm, although I did have to make dynamic adjustments to image src's, external javascript src's, stylesheet href's, and links on the page to account for the new url of the output page. Thanks again.
        append it to text of main file and do it.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://755448]
Approved by moritz
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (7)
As of 2024-04-16 11:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found