[Html-widget] trying to get the type of an element
Carl Franks
fireartist at gmail.com
Wed Nov 15 09:09:30 GMT 2006
On 14/11/06, John Napiorkowski <jjn1056 at yahoo.com> wrote:
> Okay,
>
> This is probably not the smartest question, but I've
> looked at the source and the docs and I can't figure
> out how to get the type of an element. I just can't
> say:
>
> $element->type;
>
> or any other combination I can think of. There must
> be a way to do this. Anyone know?
The only way to get that just now would be ref( $element )
but that would give something like 'HTML::Widget::Element::Textfield'
You could use add a new method to H/W/Elements with mk_accessors()
and then edit H/Widget::element() to store the type it receives, using
that method after it's created the element.
Unfortunately, both Block and Button already have a 'type' method, so
it'll need to be a different name - I can't really think of anything
else that's suitable, as 'type' would be most appropriate.
Carl
More information about the Html-widget
mailing list