Subject: | calling make_schema_at modifes @INC |
Tested under Win32 strawberryperl 5.14.2.1 on a 64bit Windows 7 machine.
After a call to make_schema_at, the current directory '.' disappears
from @INC.
As an example consider the following method:
sub dump_schema {
my $attrs = {
debug => 0,
dump_directory => '.',
exclude => qr/(?^:\bBIN)/
};
my $connect_info = [ $dsn, $user, $password ];
push @$connect_info, { on_connect_do => 'PRAGMA foreign_keys = ON' };
make_schema_at( 'TDG::Schema', $attrs, $connect_info );
eval {
require TDG::Schema;
TDG::Schema->import();
1;
} or do {
my $error = $@;
croak $error;
};
$dbic_schema = TDG::Schema->connect( $dsn, $user, $password, '' );
}
The error I got when executing it (using a connection to a SQLite
database) was:
Can't locate TDG/Schema.pm in @INC...
Before calling make_schema_at, we have:
DB<2> x @INC
0 'C:/Dwimperl/perl/site/lib'
1 'C:/Dwimperl/perl/vendor/lib'
2 'C:/Dwimperl/perl/lib'
3 '.'
afterwards:
DB<3> x @INC
0 'C:/Dwimperl/perl/site/lib'
1 'C:/Dwimperl/perl/vendor/lib'
2 'C:/Dwimperl/perl/lib'
Which explains the error.