Re: How to get the Class name of an element



Pelle Nilsson <pellenilsson fastmail fm> writes:
if (substr($text, 0, 11) eq 'Gtk2::Entry') {
    print "Entry!\n";
} elsif (substr($text, 0, 14) eq 'Gtk2::ComboBox') {
    print "ComboBox!\n";
}

This might be better written as

  if (ref($text) eq 'Gtk2::Entry') {
     ...

:)
-- 
Dave Hayes - Consultant - Altadena CA, USA - dave jetcafe org 
The opinions expressed above are entirely my own <<<

"That's a very dangerous lake, Nasrudin. People who swim in
it are always being found dead at the bottom."

"That's alright, friend", replied Nasrudin. "I'll keep well
away from the bottom..."





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