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


in reply to Re: How does perl's file I/O work?
in thread How can I access a file on a remote server?

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Re: Re: How does perl's file I/O work?
by pfaut (Priest) on Jan 20, 2003 at 20:27 UTC

    Well, it describes a little more about what you want to accomplish but it still isn't clear. You need to write a CGI program that accesses a file on an AIX machine. Will the CGI program run on the AIX machine or do you need to access the text file from a web application running 'outside' (whatever 'outside' means)?

    --- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';
      ok.."outside" means this. my perl script will be on my PC. and this particular perl script needs to access the AIX machine and gets the text file out so I can use its information to for my web application. Is that clear? THanks a lot..
Re: Re: Re: How does perl's file I/O work?
by Fletch (Bishop) on Jan 20, 2003 at 20:21 UTC

    It's more clear, but it's still trivial. Unless you can produce specific code that you've attempted to write that produces an error which you can't understand the entry for which in perldoc perldiag, you're probably not going to get someone jump forward and offer to write your program for you. Your best bet is to either show the code that's not working, or avail yourself of a tutorial or book (or any of the number of code samples available in the Snippets Section).

      Thanks for all you help first of all I appreicate it. the thing is, I have no idea how to start like I don't know where to look...is this a socket client/server communication type of thing or what? like....if u see what I mean...yes it is just a simple opening a file on unix system problem...if my program/script is on the unix system then it's easy, evena beginner knows...but the problem is I have to access that file OUTSIDE of the system. like...I have no idea perl could do taht before and I had been searching for days I don;'t know where to look. If someone could give me some ideas or some hints as to wehre to look for answer that would be great. I had been looking at differnet functions, POSIX and stuff....no idea....I am really lost.

        You need to determine how the file can be accessed from 'outside'. If the file is accessable through an FTP server, you can read it with Net::FTP. If it is available on a web server, you can try various modules including LWP::Simple.

        --- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';
Re: How does perl's file I/O work?
by boo_radley (Parson) on Jan 20, 2003 at 21:24 UTC
    OK in our company we have a RS6000 machine...that uses AIX as its OS, and there is a text file on it that I need to gain access from the outside because I need to write a CGI program/webpage that collects information from taht text file, that's why I need a perl program taht have access to that text file on the Unix system, is that more clear?
    No.
    Have you talked with the sysadmin of this box? does your RS6000 have, say, FTP, telnet, or SSH enabled? Can the file be placed in a public or trusted network share or web site? How would you, as a person, as a user, get to the file?
    If the answer is "I don't know" you need to do more legwork, and less programming.
      ok I am very sorry for being unclear and also I would really like to thank you all for helping! :) anyways it is telnet enabled. And as a person I would login thru telnet and the file is places in my root directary. IS there anything else I missed? I am sorry.
Re: Re: Re: How does perl's file I/O work?
by Anonymous Monk on Jan 20, 2003 at 20:36 UTC
    Thanks for all you help first of all I appreicate it. the thing is, I have no idea how to start like I don't know where to look...is this a socket client/server communication type of thing or what? like....if u see what I mean...yes it is just a simple opening a file on unix system problem...if my program/script is on the unix system then it's easy, evena beginner knows...but the problem is I have to access that file OUTSIDE of the system. like...I have no idea perl could do taht before and I had been searching for days I don;'t know where to look. If someone could give me some ideas or some hints as to wehre to look for answer that would be great. I had been looking at differnet functions, POSIX and stuff....no idea....I am really lost.
Re: Re: Re: How does perl's file I/O work?
by Anonymous Monk on Jan 20, 2003 at 20:40 UTC
    'outside' as in my PC. THe perl script itself is going to be on my PC, which is wehre my CGI/web application is. So therefore , as I said before, I need the script to somehow access the AIX machine from my PC and access that file and use that information for my program. thanks a lot for all ur help, I just need any kinda hints for me as to where to look. Is this related to SOCKETs client/server communciation?> I have no idea..thanks..kelvin
Re: Re: Re: How does perl's file I/O work?
by Anonymous Monk on Jan 20, 2003 at 20:45 UTC
    In case you are interested, the reason why I wnat to access the file ON the AIX machine and not just ftp the file to my PC is because that file on the AIX machine is constantly updating. I hve another perl script on the AIX machine taht runs every 15 mins to update that text file. And my CGI program needs to get from taht text file. So that's why. again, I don;t expect you to code it for me, but any kinda help would be find or at least just give me some directions. I don't even knwo wehre to look or I don';t eve know if Perl can do this.\