Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: raw image data?

by ikegami (Patriarch)
on Apr 21, 2009 at 15:44 UTC ( [id://759030]=note: print w/replies, xml ) Need Help??


in reply to raw image data?

That means it's expecting the contents of the file.
my $raw_image_data = do { open(my $fh, '<:raw:perlio', $image_qfn) or die("Can't open image file \"$image_qfn\": $!\n); local $/; <$fh>; };

Replies are listed 'Best First'.
Re^2: raw image data?
by 23skiddoo (Beadle) on Apr 21, 2009 at 15:58 UTC
    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
      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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://759030]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (1)
As of 2024-04-26 02:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found