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); }