in reply to Re: raw image data?
in thread raw image data?

Hmm... I tried a similar route before coming to the monastery:
open my $fh, "<", $image_file or die "Can't open $image_file: $!"; my $raw = <$fh>;
Which I believe is the same as the slurp() function mentioned above. It failed. I tried your code too, with the same failure. The file has to be under 700K and my test files have definitely been below that. There must be something else going on. Unfortunately the error messages returned don't provide much help.

Thanks for your help!

fnord

Replies are listed 'Best First'.
Re^3: raw image data?
by kwaping (Priest) on Apr 21, 2009 at 17:04 UTC
    Did you binmode the filehandle?

    ---
    It's all fine and dandy until someone has to look at the code.
      A flash of hope! But, alas, that did not work. I tried both
      open my $fh, "<", $img or die "Can't open $img: $!"; my $raw = <$fh>;
      and
      open my $fh, "<:raw", $img or die "Can't open $img: $!"; my $raw = <$fh>;
      I know my use of Net::Twitter works to post text, it's just this picture updating that is failing. I suppose it could be a problem with the module itself. Maybe I should try it with some LWP or REST mojo...?
      fnord

        fyi, :raw turns off buffering too, that's why I used :raw:perlio.

        You also only read up 'til the first \x0A. Not very useful.

        I tried a similar route before coming to the monastery

        Similar, but worlds apart. Did you actually try the code we provided, or did you just dismiss them as similar enough.

        Please post your code, and a dump of the results from get_error() after a failed image upload attempt.
        Thanks!

        ---
        It's all fine and dandy until someone has to look at the code.