Is it possible to open a file at a second ISP?

Discussion in 'Perl Misc' started by Jerry, Dec 7, 2005.

  1. Jerry

    Jerry Guest

    When running a script at the first ISP I want to open a file at a
    mirror site on a second ISP and append to it. Is this possible?

    I know this does not work.

    open(FILE,">>/www/user/mysite2.com/WORLD_WRITABLE/notification.sav") ||
    die "cannot open notification.sav: $!";
    foreach my $p (param()) {
    print FILE "$p = ", param($p), "\|";
    } print FILE "\n";

    close (FILE);

    I was told at another forum that I will have to write a program using
    the http call to do this. I am far from a Perl programmer, but have
    researched my 11 books (including 6 O'Reilly Books and the Stein cgi.pm
    book) and the PerlFaqs and found nothing on this.
    Jerry, Dec 7, 2005
    #1
    1. Advertising

  2. Jerry

    Matt Garrish Guest

    "Jerry" <> wrote in message
    news:...
    > When running a script at the first ISP I want to open a file at a
    > mirror site on a second ISP and append to it. Is this possible?
    >
    > I know this does not work.
    >
    > open(FILE,">>/www/user/mysite2.com/WORLD_WRITABLE/notification.sav") ||
    > die "cannot open notification.sav: $!";
    > foreach my $p (param()) {
    > print FILE "$p = ", param($p), "\|";
    > } print FILE "\n";
    >
    > close (FILE);
    >
    > I was told at another forum that I will have to write a program using
    > the http call to do this. I am far from a Perl programmer, but have
    > researched my 11 books (including 6 O'Reilly Books and the Stein cgi.pm
    > book) and the PerlFaqs and found nothing on this.
    >


    I suspect your advice was to write a separate cgi script (or web service) on
    the second machine and then post the data from the script on the first
    machine. For a cgi, see the LWP documentation (including lwpcook) for how to
    post data to another server. I'll assume that you can write a script to
    process the call and write the data to the file once it gets there. You
    might also want to have a look at the SOAP::* modules, but I would have to
    think a cgi is simpler in this case.

    Matt
    Matt Garrish, Dec 7, 2005
    #2
    1. Advertising

  3. Jerry

    Guest

    Jerry wrote:
    > When running a script at the first ISP I want to open a file at a
    > mirror site on a second ISP and append to it. Is this possible?
    >
    > open(FILE,">>/www/user/mysite2.com/WORLD_WRITABLE/notification.sav") ||


    That command will look for a file in a local filesystem called
    /www/user....

    You can use File::Remote to open a remote file "as if" it were a local
    file, or you can transfer an existing file with something like Net::FTP
    or NET::SFTP.
    , Dec 7, 2005
    #3
  4. Jerry wrote:
    > When running a script at the first ISP I want to open a file at a
    > mirror site on a second ISP and append to it. Is this possible?


    <snip>

    > I was told at another forum that I will have to write a program using
    > the http call to do this.


    Using LWP at the first ISP it's possible. But please be careful, and use
    some kind of authentication.

    > I am far from a Perl programmer, but have
    > researched my 11 books (including 6 O'Reilly Books and the Stein cgi.pm
    > book) and the PerlFaqs


    Wow, that ought to be more than enough.

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, Dec 7, 2005
    #4
  5. Jerry

    Jerry Guest

    Thanks. I went to Nathan Wiger's site and read the doc on
    File::Remote. It looks like the answer, but what type of address is
    supposed to be used for host? What if I had an address of
    http://www.mysite.com, would this be the host?
    Example:

    use File::Remote qw:)replace); # special :replace tag

    # read from a remote file
    open(REMOTE, "host:/remote/file") or die $!;
    print while (<REMOTE>);
    close(REMOTE);
    Jerry, Dec 7, 2005
    #5
  6. Jerry

    Guest

    Jerry wrote:
    > Thanks. I went to Nathan Wiger's site and read the doc on
    > File::Remote. It looks like the answer, but what type of address is
    > supposed to be used for host? What if I had an address of
    > http://www.mysite.com, would this be the host?


    Try it and see ;)

    If it doesn't work, check the error message.
    , Dec 7, 2005
    #6
  7. wrote:
    >>When running a script at the first ISP I want to open a file at a
    >>mirror site on a second ISP and append to it. Is this possible?
    >>
    >>open(FILE,">>/www/user/mysite2.com/WORLD_WRITABLE/notification.sav") ||

    >
    > That command will look for a file in a local filesystem called
    > /www/user....
    >
    > You can use File::Remote to open a remote file "as if" it were a local
    > file,


    Had never heard of File::Remote, but it sounds kind of strange to me.
    The docs say: "It allows you to create and edit files without having to
    worry about their physical location on the network." But two ISPs aren't
    likely on the same network, or...?

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, Dec 7, 2005
    #7
  8. Jerry

    Dr.Ruud Guest

    Gunnar Hjalmarsson:

    > Had never heard of File::Remote, but it sounds kind of strange to me.
    > The docs say: "It allows you to create and edit files without having
    > to worry about their physical location on the network." But two ISPs
    > aren't likely on the same network, or...?


    I haven't checked, but it could use scp, or even (s)ftp, to cache and
    edit local copies, and update the remote originals (internet as "the
    network").

    --
    Affijn, Ruud

    "Gewoon is een tijger."
    Dr.Ruud, Dec 7, 2005
    #8
  9. Dr.Ruud wrote:
    > Gunnar Hjalmarsson:
    >>Had never heard of File::Remote, but it sounds kind of strange to me.
    >>The docs say: "It allows you to create and edit files without having
    >>to worry about their physical location on the network." But two ISPs
    >>aren't likely on the same network, or...?

    >
    > I haven't checked, but it could use scp, or even (s)ftp, to cache and
    > edit local copies, and update the remote originals (internet as "the
    > network").


    Yeah, but since the POD examples don't include login stuff, I began to
    wonder.

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, Dec 7, 2005
    #9
  10. Jerry

    Dr.Ruud Guest

    Gunnar Hjalmarsson:
    > Dr.Ruud:
    >> Gunnar Hjalmarsson:


    >>> Had never heard of File::Remote, but it sounds kind of strange to
    >>> me. The docs say: "It allows you to create and edit files without
    >>> having to worry about their physical location on the network." But
    >>> two ISPs aren't likely on the same network, or...?

    >>
    >> I haven't checked, but it could use scp, or even (s)ftp, to cache and
    >> edit local copies, and update the remote originals (internet as "the
    >> network").

    >
    > Yeah, but since the POD examples don't include login stuff, I began to
    > wonder.


    OK, now I have checked
    http://search.cpan.org/~nwiger/File-Remote/Remote.pm
    and in the Description it says:
    "If a file passed into a function is of the form host:/path/to/file,
    then File::Remote uses rsh/rcp (or ssh/scp, depending on how you
    configure it) to edit the file remotely. [...] One advantage of the
    object-oriented method is that this allows you to read and write from
    different servers using different methods (eg, rsh vs. ssh)
    simultaneously"
    From the Notes: "the remote file is not synched until close() is called
    on the filehandle."

    --
    Affijn, Ruud

    "Gewoon is een tijger."
    Dr.Ruud, Dec 7, 2005
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Luuk Postuma

    Deployment problems with ISP

    Luuk Postuma, Oct 21, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    326
    Elliot M. Rodriguez
    Oct 21, 2003
  2. JerryK

    ISP recommendation

    JerryK, Nov 5, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    327
    Steve
    Nov 5, 2003
  3. AAaron123
    Replies:
    7
    Views:
    374
    AAaron123
    Nov 9, 2008
  4. codeit
    Replies:
    0
    Views:
    92
    codeit
    Aug 9, 2006
  5. yelipolok
    Replies:
    4
    Views:
    243
    John W. Krahn
    Jan 27, 2010
Loading...

Share This Page