Hi,

On Sat, Jun 23, 2012 at 2:02 AM, A Kobame <kobam...@gmail.com> wrote:
> could you please add to the next Mason2 version - adding:
>
> use utf8;
>
> into each generated *.obj file?

You can do it like this:

package My::Mason::Compilation;
use Mason::Moose;

extends 'Mason::Compilation';

override 'output_class_header' => sub {
  return join("\n", super(), 'use utf8;');
};


1;

And when you create your Mason instance:

  my $mason = Mason->new(
    base_compilation_class => 'My::Mason::Compilation',
    ...
  );


I use that extensively.

I don't agree that a specific "use utf8" should be added be default.
OTHO, the above ::Compilation subclass is the first thing I type when
starting a new Mason project, so maybe a shortcut like:

  Mason->new(common_obj_header => 'perl code here, for ex. use uft8;')

would save some typing...


> It will not disturb current US/ASCII Mason2 users, but would greatly
> helps others.

Given that my largest app is iso-latin-1 I can say that it would
affect me immensely.

> Sure, it is possible achieve it with my own plugin, what will
> overwrite the output_class_header method, but it is really strange
> writing plugin for such easy thing.

Agreed. I just don't agree that utf8 should be a default.


> And you can take into consideration the: "use Encode qw(encode decode)" too...

.. hence a 'common_obj_header' might be a better solution...

Bye,
-- 
Pedro Melo
@pedromelo
http://www.simplicidade.org/
http://about.me/melo
xmpp:m...@simplicidade.org
mailto:m...@simplicidade.org

------------------------------------------------------------------------------
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