I'm a pretty total newbie to Tk, and I wanted to play with JPEG support. I searched CPAN and checked out Tk::JPEG, which seemed suited for my purposes. So I installed it, read the Tk documentation and tried to write a small script which will display the file 'test.jpg'. However, when I tried to run this:
use strict; use warnings; use Tk; use Tk::JPEG; my($main_window); $main_window = MainWindow->new(); $main_window->Photo(-format => 'jpeg', -file => 'test.jpg')->pack; MainLoop;
I was greeted with the fateful words:
'wrong # args: should be "pack option arg ?arg ...?" at tk.pl line 9.'
Not to be put off, I tried specifying more arguments to the pack function., specifically '-side => 'bottom'' and '-expand => 1'. Rather annoyingly, this caused the following incomprehensible error message:
'bad option "image1": must be configure, forget, info, propagate or sl +aves at tk.pl line 9'
Removing either of the arguments furnished no solution. The most helpful thing someone could do here would just be to post a very basic chunk of Tk::JPEG using code, that I could learn from. I expect it's something really simple I'm missing here, but hey, better to ask and be a fool for five minutes...

In reply to Tk::JPEG by Amoe

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.