in reply to Downloading Gmail attachments - Corrupted saved file

open (FILE, ">:raw:perlio" . $att->{filename});

:raw removes default layers which may transform the data being printed. :perlio reintroduces buffering.

> instead of >> replaces existing files instead of corrupting existing files by appending to them.

Update: Added explanations.

Replies are listed 'Best First'.
Re^2: Downloading Gmail attachments - Corrupted saved file
by casimo (Sexton) on Dec 30, 2009 at 23:52 UTC
    ikegami, I just tried rewriting that one line and there was no output.

      The concatenation dot should've been a comma:

      open (FILE, ">:raw:perlio" . $att->{filename}); ^

      To specify PerlIO layers, you need the 3-argument form of open. Otherwise, the name of the file you try to create will literally start with ":raw:perlio"...

        almut, changing that dot to a comma did the trick.

        I thank you both.