http://qs321.pair.com?node_id=229423

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

I am working on a CGI that allows me to update html pages on two different servers with the same information. I am trying to identify the "best" way to do this as the pages have different headers and footers and I only what to input the data into a form once.

I could use SSI within each page and call a CGI that would pull the same information from a remote file, but I am worried about the overhead a CGI would have each time the page is called and also the time required to pull a remote file.

I don't think SSI include can call a remote file.

What I would like is to have a CGI write the same .txt file to each server and then just call the local .txt file with SSI include from the respective servers.

Any ideas on the best approach to writing files to multiple remote servers and what are the security/coding dangers/problems to look out for?

  • Comment on Best way to update and integrate remote files

Replies are listed 'Best First'.
Re: Best way to update and integrate remote files
by Aristotle (Chancellor) on Jan 23, 2003 at 22:32 UTC
    You could easily write a CGI script which, upon invocation, reposts the data it was called with to several other scripts - in this case, one copy of the file updater CGI on each server you want to do this on. LWP should make this quite simple - but be careful not to make your script useable by others to invoke arbitrary scripts on arbitrary servers.

    Makeshifts last the longest.

Re: Best way to update and integrate remote files
by bronto (Priest) on Jan 24, 2003 at 09:18 UTC

    Maybe you could take into consideration XML: you could write your site's contents in XML and having them transformed in two different HTML versions on the two servers. In fact, since what changes is not the content but just the header and footer, you could even use the same identical XML document on the two servers, and having it transformed in different ways by different stylesheets

    A Perlish way to do this is AxKit. You can use standard XSLT stylesheets or a XPathScript one (XPathScript is a a stylesheet language that uses Perl). Take a look!

    Ciao!
    --bronto

    # Another Perl edition of a song:
    # The End, by The Beatles
    END {
      $you->take($love) eq $you->make($love) ;
    }

Re: Best way to update and integrate remote files
by iguanodon (Priest) on Jan 24, 2003 at 03:13 UTC
    Can these two servers share a file system? If so you can keep one copy of the file and use SSI to include it from both servers. That way you don't have to worry about different copies of the file being out of sync.