Revision history for Perl extension DBIx::Class::Schema::Loader
+ - remove dependency on File::Slurp
- allow the constraint and exclude options to be used simultaneously
(bphillips)
- fix Oracle common tests fail with multi_schema due to not resetting
requires 'Class::Inspector' => 0;
requires 'DBIx::Class' => '0.08127';
requires 'Class::Unload' => 0;
-requires 'File::Slurp' => '9999.14';
requires 'List::MoreUtils' => 0;
requires 'namespace::clean' => '0.20';
requires 'Scope::Guard' => 0;
use warnings;
use Data::Dumper ();
use Test::More;
-use File::Slurp 'read_file';
use namespace::clean;
use Exporter 'import';
}
sub slurp_file($) {
- my $data = read_file(shift, binmode => ':encoding(UTF-8)');
+ open my $fh, '<:encoding(UTF-8)', shift;
+ my $data = do { local $/; <$fh> };
+ close $fh;
$data =~ s/$CRLF|$LF/\n/g;
use Class::Unload;
use File::Temp qw/tempfile tempdir/;
use IO::File;
-use File::Slurp 'slurp';
use DBIx::Class::Schema::Loader ();
+use DBIx::Class::Schema::Loader::Utils 'slurp_file';
use Lingua::EN::Inflect::Number ();
use lib qw(t/lib);
use make_dbictest_db_with_unique;
my $schema = $res->{schema};
my $file = $schema->loader->get_dump_filename($SCHEMA_CLASS);
- my $code = slurp $file;
+ my $code = slurp_file $file;
my ($dumped_ver) =
$code =~ /^# Created by DBIx::Class::Schema::Loader v(\S+)/m;
my ($schema, $class, $re, $test_name) = @_;
my $file = $schema->loader->get_dump_filename($class);
- my $code = slurp $file;
+ my $code = slurp_file $file;
like $code, $re, $test_name;
}
use strict;
+use warnings;
use Test::More;
use Test::Exception;
use Test::Warn;
-use lib qw(t/lib);
-use File::Slurp qw(slurp);
+use DBIx::Class::Schema::Loader::Utils 'slurp_file';
use File::Path;
+use lib qw(t/lib);
use make_dbictest_db_comments;
use dbixcsl_test_dir qw/$tdir/;
plan tests => 4;
-my $foo = slurp("$dump_path/DBICTest/Schema/1/Result/Foo.pm");
-my $bar = slurp("$dump_path/DBICTest/Schema/1/Result/Bar.pm");
+my $foo = slurp_file("$dump_path/DBICTest/Schema/1/Result/Foo.pm");
+my $bar = slurp_file("$dump_path/DBICTest/Schema/1/Result/Bar.pm");
like($foo, qr/Result::Foo - a short comment/, 'Short table comment inline');
like($bar, qr/Result::Bar\n\n=head1 DESCRIPTION\n\na (very ){80}long comment/,
use strict;
+use warnings;
use Test::More;
use Test::Exception;
use Test::Warn;
-use lib qw(t/lib);
-use File::Slurp qw(slurp);
+use DBIx::Class::Schema::Loader::Utils 'slurp_file';
use File::Path;
+use Try::Tiny;
+use lib qw(t/lib);
use make_dbictest_db_bad_comment_tables;
use dbixcsl_test_dir qw/$tdir/;
-use Try::Tiny;
my $dump_path = "$tdir/dump";
plan tests => 1;
-my $foo = try { slurp("$dump_path/DBICTest/Schema/1/Result/Foo.pm") };
-my $bar = try { slurp("$dump_path/DBICTest/Schema/1/Result/Bar.pm") };
+my $foo = try { slurp_file("$dump_path/DBICTest/Schema/1/Result/Foo.pm") };
+my $bar = try { slurp_file("$dump_path/DBICTest/Schema/1/Result/Bar.pm") };
like($foo, qr/Result::Foo\n/, 'No error from invalid comment tables');
use strict;
+use warnings;
use Test::More;
use Test::Exception;
use Test::Warn;
-use lib qw(t/lib);
-use File::Slurp qw(slurp);
+use DBIx::Class::Schema::Loader::Utils 'slurp_file';
use File::Path;
+use lib qw(t/lib);
use make_dbictest_db;
use dbixcsl_test_dir qw/$tdir/;
plan tests => 1;
-my $foo = slurp("$dump_path/DBICTest/Schema/1/Result/Foo.pm");
-my $bar = slurp("$dump_path/DBICTest/Schema/1/Result/Bar.pm");
+my $foo = slurp_file("$dump_path/DBICTest/Schema/1/Result/Foo.pm");
+my $bar = slurp_file("$dump_path/DBICTest/Schema/1/Result/Bar.pm");
like($foo, qr/Result::Foo\n/, 'No error from lack of comment tables');