From: Rafael Kitover Date: Thu, 13 Oct 2011 17:04:52 +0000 (-0400) Subject: add "use utf8;" at the top of all generated files X-Git-Tag: 0.07011~32 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class-Schema-Loader.git;a=commitdiff_plain;h=c6c8787c72c12772f92c54591493d00fdc12549e add "use utf8;" at the top of all generated files In preparation for supporting Unicode identifiers in the future, this commit adds "use utf8;" to the top of all generated files, before the "package ...;" statement. --- diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index 53cb74c..befe435 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -1594,7 +1594,8 @@ sub _dump_to_dir { unless $self->dynamic or $self->quiet; my $schema_text = - qq|package $schema_class;\n\n| + qq|use utf8;\n| + . qq|package $schema_class;\n\n| . qq|# Created by DBIx::Class::Schema::Loader\n| . qq|# DO NOT MODIFY THE FIRST PART OF THIS FILE\n\n|; @@ -1644,7 +1645,8 @@ sub _dump_to_dir { foreach my $src_class (@classes) { my $src_text = - qq|package $src_class;\n\n| + qq|use utf8;\n| + . qq|package $src_class;\n\n| . qq|# Created by DBIx::Class::Schema::Loader\n| . qq|# DO NOT MODIFY THE FIRST PART OF THIS FILE\n\n|; diff --git a/t/23dumpmore.t b/t/23dumpmore.t index a1cd0cd..032aa66 100644 --- a/t/23dumpmore.t +++ b/t/23dumpmore.t @@ -157,7 +157,7 @@ $t->dump_test( $t->cleanup; -# test out the POD +# test out the POD and "use utf8;" $t->dump_test( classname => 'DBICTest::DumpMore::1', options => { @@ -173,10 +173,12 @@ $t->dump_test( }, regexes => { schema => [ + qr/^use utf8;\n/, qr/package DBICTest::DumpMore::1;/, qr/->load_classes/, ], Foo => [ + qr/^use utf8;\n/, qr/package DBICTest::DumpMore::1::Foo;/, qr/\n=head1 NAME\n\nDBICTest::DumpMore::1::Foo\n\n=cut\n\nuse strict;\nuse warnings;\n\n/, qr/\n=head1 BASE CLASS: L\n\n=cut\n\nuse base 'My::ResultBaseClass';\n\n/, @@ -194,6 +196,7 @@ $t->dump_test( qr/1;\n$/, ], Bar => [ + qr/^use utf8;\n/, qr/package DBICTest::DumpMore::1::Bar;/, qr/\n=head1 NAME\n\nDBICTest::DumpMore::1::Bar\n\n=cut\n\nuse strict;\nuse warnings;\n\n/, qr/\n=head1 BASE CLASS: L\n\n=cut\n\nuse base 'My::ResultBaseClass';\n\n/,