in reply to Re^3: In memory filehandles
in thread In memory filehandles

I generalised an actual problem I had: using in-memory filehandles with Archive::Zip. Thus, I'm stuck to passing something that a third party library likes, which basically eliminates the third solution. The second solution seems a bit overkill and not scalable, but it could come handy with proper localisation I think. The first... I'll give it a try.

I'm also thinking about blessing the filehandle directly to IO::File, and see what happens.

Flavio
perl -ple'$_=reverse' <<<ti.xittelop@oivalf

Don't fool yourself.

Replies are listed 'Best First'.
Re^5: In memory filehandles
by ysth (Canon) on Jan 27, 2006 at 10:31 UTC
    You'd probably be best off just using IO::String.

    It looks to me like Archive::Zip would have the same problem with any filehandle opened with the open builtin, even disk files; is this the case?

      The workaround with IO::File worked fine, and it doesn't require the installation of external modules in recent perls. While probably not the best for long-term production code, I find it better for example scripts that can work with the least requirement for the user.

      About open() you're right... probably. One of the thousands things I tried involved using File::Temp to get a temporary, "real-file" handle, but the readFromFileHandle() method continued to complain. I had to use the filename given back by File::Temp instead of the filehandle.

      Flavio
      perl -ple'$_=reverse' <<<ti.xittelop@oivalf

      Don't fool yourself.