dilemma?(perl)

  • akaash
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Jan 28, 2004
  • Posts: 62
  • Loc: Gujurat,India
  • Status: Offline

Post April 3rd, 2004, 10:58 am

my project is about archiving mails from one linux server(main) to another linux server(backup).

this is done. but now i want my users to be able to view the mails again which they have archived.

i m having 3 options:

1 - give url of the cgi script running on backup server which is almost same as that running on main server. that script will be able to display the archived mails of backup server as my main script on main server is doing.

2 - Display the mails using sockets in perl by transfering msgs. and displaying.

3 - Is there a way in perl/cgi to open remote file. i.e. my main script,which is on main server, can access the backup server's file ?

I m confused for which of these ways to go for? please help me taking all +points and -points of the prefered approch.

And ya is the 3rd option possible ; f so then how?
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post April 3rd, 2004, 10:58 am

  • Managedlinks
  • Proficient
  • Proficient
  • No Avatar
  • Joined: Mar 31, 2004
  • Posts: 294
  • Status: Offline

Post April 4th, 2004, 5:07 pm

to get a file from a remote server is very simple

an example would be...

--------------------------------------------------------------------------------------
use LWP::Simple;

my $page_contents = get("http://www.myremoteserver.com/cgi-bin/getarchive.pl?msg=1234567890");

print "content-type: text/html\n\n";

if ($page_contents )
{
print $page_contents;
}
else
{
print <h1>Error retrieving document</h1>";
}
------------------------------------------------------------------------------------
  • akaash
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Jan 28, 2004
  • Posts: 62
  • Loc: Gujurat,India
  • Status: Offline

Post April 4th, 2004, 10:39 pm

ya this is working thanks for it but in this manner i will have to import that remote file and store it somewhere on my main server but is there any way to open the remote file and read from it. I don't want to import that file but i want to open remote file in its place itself , is there a way?
  • Managedlinks
  • Proficient
  • Proficient
  • No Avatar
  • Joined: Mar 31, 2004
  • Posts: 294
  • Status: Offline

Post April 4th, 2004, 10:52 pm

why would you need to import the remote file ?

the script called "getarchive.pl" on the remote(archive) server would get only the archived message that was requested.

in the above example the message was indicated by the fictitious identifier "msg=1234567890"
  • akaash
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Jan 28, 2004
  • Posts: 62
  • Loc: Gujurat,India
  • Status: Offline

Post April 5th, 2004, 7:30 pm

ok fine and i found a module called file::remote which allows editing remote files.

Anyhow thanks for ur cooperation,
akaash...
  • Managedlinks
  • Proficient
  • Proficient
  • No Avatar
  • Joined: Mar 31, 2004
  • Posts: 294
  • Status: Offline

Post April 5th, 2004, 7:35 pm

Sorry I didn't know you wanted to edit remote files. that is vastly different from just viewing them

Good luck

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 179 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.