Tweaks autogenerated glade files so all objects end up in a easily accessable hash -Thanks to PodMaster for the suggested modification to the pod.
=pod =head1 tweak_gladefiles.pl tweak_gladefiles - version 0.01 Mon Mar 3 19:31:05 EST 2003 Patches dynamically generated Glade code files =head1 SYNOPSIS cd project_directory tweak_gladefiles =head1 DESCRIPTION Glade is a nice user interface generator that generates perl c +ode to automatically create an user interface. It can be found at ht +tp://glade.gnome.org/. However one particular aspect of this generated code really bugs me. Instead of creating a global variable with references to all t +he UI objects, it creates one hash per window, and keeps the hash of + objects as a package variable. For some reason I can't access this var +iable from another namespace. It also doesn't fit my ideas of neatness. Enter this little patch, which tracks down all instances of th +is annoying little hash and patches them so that all objects in your progr +am are referenced in %FORMS::allforms. Now you can access any UI object with $FORMS::all_forms{window +name}->{objectname} Note that it is safe to run this program multiple times over t +he same code. =cut opendir DH, 'src' or die "Couldn't open source directory src/ $!\n"; @files = readdir DH; closedir DH; foreach ( @files ) { next if /^\./; next if /\.bak$/; my $command = 'perl -pe\'s/__PACKAGE__::all_forms/FORMS::all_ +forms/g;\' -i.bak src/ '.$_; print "About to execute $command\n"; system($command); }

In reply to Tweak all_forms variable in glade code files by jepri

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.