=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 code to automatically create an user interface. It can be found at http://glade.gnome.org/. However one particular aspect of this generated code really bugs me. Instead of creating a global variable with references to all the 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 variable from another namespace. It also doesn't fit my ideas of neatness. Enter this little patch, which tracks down all instances of this annoying little hash and patches them so that all objects in your program are referenced in %FORMS::allforms. Now you can access any UI object with $FORMS::all_forms{windowname}->{objectname} Note that it is safe to run this program multiple times over the 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); }