Adding data via a role
package HasCSS;
use Moose::Role;
use MooseX::AttributeHelpers;
has 'css' => (
metaclass => 'Collection::Hash',
is => 'ro',
isa => 'HashRef[Str]',
...
);
package HTML::Form::Input;
use Moose;
with 'HasCSS';
...
- Then elsewhere:
sub convert_to_html {
my $foo = shift;
if($foo->does('HasCSS')){
# handle the CSS
}
# handle the HTML
}