Does anyone else here actually use glade with perl?

I've been playing around with it for a bit and I've got myself really 
confused.  I can't really seem to make head nor tail of the code it spits 
out.  In the end I've resorted to extracting the code by hand from the 
modules it produces and evaling it into my modules.  Like so:

And does anyone know what _( ) is actually meant to do?

Example Code
------------

#!/usr/bin/perl

use strict;
use warnings;

use Gtk;
Gtk->init;

use Indico::Util::FileOpBag;
use File::Spec::Functions;

# okay we suck the generated source file in and extract the bit
# we actually care about
my $glade = slurpfile(catfile("src","ImageresizerUI.pm"));
$glade =~ s/^.*?Construct a GtkWindow 'mainwindow'//s;
$glade =~ s/Return the constructed UI.*?$//s;
$glade = 'local *main::_ = sub { return @_ }; ' . $glade;

# create the widgets
my $forms;
my $widgets;
eval $glade;
$@ and die "Problem: $@";

$widgets->{'mainwindow'}->show();
Gtk->main;

-- 
s''  Mark Fowler                                     London.pm   Bath.pm
     http://www.twoshortplanks.com/              [EMAIL PROTECTED]
';use Term'Cap;$t=Tgetent Term'Cap{};print$t->Tputs(cl);for$w(split/  +/
){for(0..30){$|=print$t->Tgoto(cm,$_,$y)." $w";select$k,$k,$k,.03}$y+=2}


Reply via email to