dilemma?(perl)

  • akaash
  • Beginner
  • Beginner
  • akaash
  • Posts: 62
  • Loc: Gujurat,India

Post 3+ Months Ago

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
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Managedlinks
  • Proficient
  • Proficient
  • Managedlinks
  • Posts: 294

Post 3+ Months Ago

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
  • akaash
  • Posts: 62
  • Loc: Gujurat,India

Post 3+ Months Ago

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
  • Managedlinks
  • Posts: 294

Post 3+ Months Ago

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
  • akaash
  • Posts: 62
  • Loc: Gujurat,India

Post 3+ Months Ago

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

Anyhow thanks for ur cooperation,
akaash...
  • Managedlinks
  • Proficient
  • Proficient
  • Managedlinks
  • Posts: 294

Post 3+ Months Ago

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 126 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.