Dear Monks,
I'm just fiddling around with the Perl-Gtk bindings (by the great help of this tutorial) and after removing my code to create menus 'the hard way' I went to the ItemFactory chapter to create menus 'the easy way'.

The problem is this line

$item_factory->create_items( @menu_items );

with a menu_items array that looks like

my @menu_items = ( { path => '/_File', type => '<Branch>' }, { path => '/File/_Quit', accelerator => '<control>Q', callback => \&main_quit }, { path => '/_Hilfe', type => '<LastBranch>' }, { path => '/File/About', callback => \&show_about_msg } );

But perl just says that

Can't locate object method "create_items" via package "Gtk::ItemFactor +y" at ./itemfactory line 114
which is quite sad. There _is_ a method create_item (grep finds it in the binary file auto/Gtk/Gtk.so in the appropriate directory) but that doesn't work with an array of items, at least it seems to me to be that way.

Since the documentation to this great module is ...uhm... not really existant *gg* I ask my fellow monks for advise...

Regards Stefan K


In reply to Perl-Gtk: ItemFactory by stefan k

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.