develooper Front page | perl.beginners | Postings from May 2019

Re: can I use some kind of binary string?

Thread Previous | Thread Next
Shlomi Fish
May 11, 2019 09:32
Re: can I use some kind of binary string?
Message ID:
Hi hwilmer,

On Fri, 10 May 2019 19:09:50 +0200
hwilmer <> wrote:

> Hi,
> I would like to use curl to retrieve an image from a web server which I 
> want to store in a table in a mariadb database without downloading the 
> image to a file.  For this application, I do not want to store 
> references to files stored in some file system instead.
> So I would want to use something like
> my $binary_data = `curl -k ""`;

Perl distinguishes between 8-bit/binary strings and unicode ones. See .

Note however that you should see
and use a module instead of trapping curl.exe's output. Perl has bindings to
libcurl too if that is what you want.

> The image then needs to be inserted into a LONGBLOB field via DBI in 
> such a way that the image can be restored as it was.
> Will string conversions or something prevent this from working?
> What is the usual way to do this?  It is certainly not ideal to have no 
> check on the amount of data that might be retrieved from the web server, 
> regardless whether I save it to an intermediate file or not.
> To make things more difficult, the web server is using a self-signed 
> certificate.

Shlomi Fish

He who reinvents the wheel will likely design a square wheel and spend a year
trying to figure out why it doesn’t work properly.
    — Nadav Har’El,

Please reply to list if it's a mailing list post - .

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About