Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Best way to update and integrate remote files

by belize (Deacon)
on Jan 23, 2003 at 20:54 UTC ( #229423=perlquestion: print w/replies, xml ) Need Help??

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!


    # 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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://229423]
Approved by krujos
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2019-05-26 13:31 GMT
Find Nodes?
    Voting Booth?
    Do you enjoy 3D movies?

    Results (153 votes). Check out past polls.

    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!