Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calling make_schema_at modifes @INC [rt.cpan.org #81742] #32

Open
rabbiveesh opened this issue Nov 20, 2022 · 0 comments
Open

calling make_schema_at modifes @INC [rt.cpan.org #81742] #32

rabbiveesh opened this issue Nov 20, 2022 · 0 comments

Comments

@rabbiveesh
Copy link
Contributor

Migrated from rt.cpan.org#81742 (status was 'new')

Requestors:

From [email protected] on 2012-12-06 13:40:06
:

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.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant