Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I need to use Spreadsheet::WriteExcel to generate spreadsheets with images embedded. Spreadsheet::WriteExcel has a method, insert_image, that allows images to be inserted by specifying a path to the image. However, I need to pass a scalar containing the image data instead of a path because my images will either be loaded from a database or generated programmatically. Is there a way to make the scalar act like a path, but pass the data contained in the scalar after a call to open? Is there a different, simpler way to solve this?

Thanks in advance,

--TWH

Replies are listed 'Best First'.
Re: Make scalar act like file path
by wind (Priest) on May 24, 2011 at 23:53 UTC

    I believe the simpliest solution would be to just write the contents to a temporary file and then include the image like your normally do.

    Could use File::Temp.

Re: Make scalar act like file path
by locked_user sundialsvc4 (Abbot) on May 26, 2011 at 01:38 UTC

    I don’t think that you have yet adequately described your scenario.   Considering the respective roles of both the server-side computer (the Perl code that generates this file) and the client-side computer (running Excel, and presumably attached to some network?), exactly who does what, and exactly when?