I am currently using: bintoscalar to encode images I use in my Tk applications so they can be stored in-line in the code. Like this:
# # right_bmp # # Label BMP Stored as a Scalar # # FILENAME: C:/My Documents/Clients/Dem/pl/MMG/Right.bmp # THIS FUNCTION RETURNS A BASE64 ENCODED # REPRESENTATION OF THE ABOVE FILE. # SUITABLE FOR USE BY THE -data PROPERTY. # OF A Perl/Tk PHOTO. # # Arguments: # # Returns: $binary_data # sub right_bmp { my $binary_data = <<EOD; Qk1W5ggAAAAAADYAAAAoAAAAsAEAAMIBAAABABgAAAAAACDmCAAAAAAAAAAAAAAAAAAAAA +AAAAAA . . . #Long sequence of encoded data deleted for brevity . . . CQAACwAADgIAFQwACwQABQMAAAIBAgwTAAAOAAAR EOD return($binary_data); } # END right_bmp... # # Later on in the Code... # my $Right_Picture = $root->Photo ( -data => MMG_Pictures::right_bmp(), -format => 'bmp', ); . . . # # Give Feedback to User # if($Answer == $My_Answer) { $text_Messages->Insert("YOU ARE CORRECT!\n$Problem $Answer\n"); $label_Picture->configure ( -image => $Right_Picture, ); } else { $text_Messages->Insert("WRONG!\n$Problem $Answer\nYou said:$My_A +nswer\n"); $label_Picture->configure ( -image => $Wrong_Picture, ); }
The above works great, but I would like to do the same with Audio::Wav objects so I don't have to have the .wav files all over the place, but they don't seem to have a data property. I have to admit I'm not an OO kind of person...

Any Ideas?

readmore tags added by holli


In reply to Inline Encoding Audio::Wav Objects by NateTut

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.