Ak,
you can use IMO nicer method - rewrite the Compilation.pm with:

override 'output_class_header' => sub {
      return join("\n", super(), @{$conf->get_list('obj.modules')});
};

and you can enter into *.cfg (poet config) files the needed modules
for some key, in my example i used "obj.modules". E.g: global.cfg

obj.modules:
  - "use utf8;"
  - "use Encode qw(encode decode);"
  - "use Text::WikiCreole;"

jomo

ps:
Would be nicer having the "mason.comp_modules" keyword, but for this
need Jon add it to Mason2 passed attributes, like:
               my $mason = Mason->new(comp_modules => ....);
so, modify the Mason::Interp.pm with something like
               has 'comp_modules'                  => ( default => sub { [] } );


> # e.g. Add Perl code to the top of every compiled component
> #
> override 'output_class_header' => sub {
>     return join("\n",
>             super(),
>             'use utf8;',
>            'use Encode qw(encode decode);'
>            );
> };

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to