Re: How to get the Class name of an element



On Fri, 2010-04-16 at 12:59 +0200, Pelle Nilsson wrote:
If an object is used in a string context it will return something like

Gtk2::Entry=HASH(0x12cfba8)

so you can use something like

if (substr($text, 0, 11) eq 'Gtk2::Entry') {
    print "Entry!\n";
} elsif (substr($text, 0, 14) eq 'Gtk2::ComboBox') {
    print "ComboBox!\n";
}

oh dear god, no: please, no.

'perldoc UNIVERSAL' to you too.

ciao,
 Emmanuele.

-- 
W: http://www.emmanuelebassi.name
B: http://blogs.gnome.org/ebassi




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]