Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: .CHR file read

by keszler (Priest)
on Dec 08, 2011 at 14:53 UTC ( #942456=note: print w/replies, xml ) Need Help??

in reply to File Reading (.CHR file)

From the lines #!/usr/bin/perl and open (NEWFILE, "C:\\cygwin\\home\\Administrator\\test.chr"); I'm guessing you're running this in a cygwin shell on a Windows box. Does cygwin recognize "C:\\cygwin\\..." as a path, or should it be something like "/home/Administrator/test.chr"?

Replies are listed 'Best First'.
Re^2: .CHR file read
by johngg (Abbot) on Dec 08, 2011 at 23:04 UTC

    The path should probably be /cygdrive/c/cygwin/home/Administrator/test.chr if the OP's Cygwin installation is anything like mine.



      Now that I'm home, with a box that runs cygwin:
      Windows cmd shell

      C:\cygwin\home\Keszler>dir Directory of C:\cygwin\home\Keszler 12/08/2011 07:33 PM 12 test.chr 12/08/2011 07:35 PM <DIR> x C:\cygwin\home\Keszler>cd x C:\cygwin\home\Keszler\x>dir Directory of C:\cygwin\home\Keszler\x 12/08/2011 07:35 PM 155 C:\cygwin\home\Keszler\x>type #!/usr/bin/perl use strict; use POSIX; use warnings; open (NEWFILE, "/home/Keszler/test.chr"); print "Start"; while(<NEWFILE>) { print $_; } print "end"; C:\cygwin\home\Keszler\x> readline() on closed filehandle NEWFILE at C:\cygwin\home\Keszler\x\te line 7. Startend C:\cygwin\home\Keszler\x>
      cygwin shell
      $ pwd /home/Keszler/x $ ls -l total 1 -rwxr-xr-x 1 Keszler None 155 Dec 8 19:35 $ ls -l .. total 1 -rw-r--r-- 1 Keszler None 12 Dec 8 19:33 test.chr drwxr-xr-x+ 1 Keszler None 0 Dec 8 19:35 x $ cat #!/usr/bin/perl use strict; use POSIX; use warnings; open (NEWFILE, "/home/Keszler/test.chr"); print "Start"; while(<NEWFILE>) { print $_; } print "end"; $ ./ Start1,2,3 a,b,c end $

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://942456]
[ambrus]: Corion: I think I parsed a HTTP header from a string with LWP once. You can definitely use that to create a HTTP message too. The problme is
[ambrus]: that if you do that, you'd have to find where each HTTP response ends, which is nontrivial if you want persistent connections (essential for performance if you have small requests).
[Corion]: ambrus: Yes, ideally an API that I feed the incoming data piece by piece and that I can ask "is that response done" and "what should I do next" and "please construct the appropriate redirect for me"
[Corion]: ambrus: Yes, ideally the module would do all that nasty stuff for me and give me a way to ask it what the current situation is
[ambrus]: Corion: you could also consider using some wrapper over the multi interface of curl, I think Net::Curl might be a good one, since implementing enough of what it expects from the event loop might be easier than a full AnyEvent interface.
[ambrus]: Corion: you could also consider using IO::Async and its POE driver and some HTTP module for it, but I don't know if that would solve your problems with AnyEvent+POE
[ambrus]: Corion: wait, you didn't say POE. You said Prima, let me look up what that is.
[ambrus]: Corion: have you considered just writing an AnyEvent integration for that thing?
[ambrus]: Or perhaps pushing schmorp to write one?
[ambrus]: Also, searching for an existing one on CPAN obviously

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (16)
As of 2016-12-07 16:04 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (130 votes). Check out past polls.