NAME
HTML::Widget::Accessor - Accessor Class
SYNOPSIS
use base 'HTML::Widget::Accessor';
DESCRIPTION
Accessor Class.
METHODS
attributes
attrs
Arguments: \%attributes
Return Value: \%attributes
The recommended way of setting attributes is to assign directly to a hash-ref key, rather than passing an entire hash-ref, which would overwrite any existing attributes.
# recommended - preserves existing key/value's
$w->attributes->{key} = $value;
# NOT recommended - deletes existing key/value's
$w->attributes( { key => $value } );
However, when a value is set in this recommended way, the object is not returned, so cannot be used for further chained method calls.
$w->element( 'Textfield', 'foo' )
->size( 10 )
->attributes->{'disabled'} = 'disabled';
# we cannot chain any further method calls after this
Therefore, to set multiple attributes, it is recommended you store the appropriate object, and call "attributes" multiple times.
my $e = $w->element( 'Textfield', 'foo' )->size( 10 );
$e->attributes->{'disabled'} = 'disabled';
$e->attributes->{'id'} = 'login';
"attrs" is an alias for "attributes".
mk_attr_accessors
Arguments: @names
Return Value: @names
AUTHOR
Sebastian Riedel, sri@oook.de
LICENSE
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.