Hyer, Dr. Edward wrote:
> Chris,
> 
> OK, I remember seeing the \*HANDLE notation in the docs, and it does
> work. It's one of those things where I tried it but had other bugs to
> fix yet, so forgot to try it again once they were fixed. 
> 
> I've never had to use a reference to a filehandle before, any important
> PDL lesson in why this is required?

None that I know of, just perl.  Filehandles are odd and have
always needed special handling---due to the lack of an
explicit type indicator such as $, #, @...

The good news is that if you use the IO::File methods to do
your file access then you get a reference to a filehandle back
which can simply be used here without special \* mojo as in
Doug's suggestion below.

--Chris

> P.S. As it turned out, for this particular job, the ability to read a
> compressed file took precedence over the ability to seek() in the file:
> much faster to read in the entire file and toss what I don't need than
> to uncompress/read/compress, in this case, so I ended up not using
> open/seek/close at all. TMTOWTDI....
> 
> Thanks,
> 
> --Edward H.
> 
> -----Original Message-----
> From: Chris Marshall [mailto:[email protected]] 
> Sent: Tuesday, March 10, 2009 7:42 PM
> To: [email protected]
> Cc: Hyer, Dr. Edward; [email protected]
> Subject: Re: [Perldl] Simple stuff: PDL::IO::FlexRaw and data types
> 
> Chris Marshall wrote:
>> Doug Hunt wrote:
>>> Hi Edward:  Two ideas:
>>>
>>> One, try using the newer style file open:
>>>
>>> open my $fh, '<', $file or die "Cannot open $file"; binmode($fh); # 
>>> not sure if this is necessary (probably not on unix) my $header = 
>>> readflex($fh, $hdr);
>>>
>>> (not tested!)
>>>
>>> I don't think its usual practice to pass raw file handles to
> routines:
>>> readflex(AREA, $hdr)
>>>
>>> The newer form of open gets around this problem.
>>>

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to