3 # the above line forces Test::Harness into taint-mode
9 # When in taint mode, PERL5LIB is ignored (but *not* unset)
10 # Put it back in INC so that local-lib users can actually
11 # run this test. Use lib.pm instead of an @INC unshift as
12 # it will correctly add any arch subdirs encountered
17 map { split /\Q$Config{path_sep}\E/, (/^(.*)$/)[0] } # untainting regex
19 @ENV{qw(PERL5LIB PERLLIB)} # precedence preserved by lib
22 # We need to specify 'lib' here as well because even if it was already in
23 # @INC, the above will have put our local::lib in front of it, so now an
24 # installed DBIx::Class will take precedence over the one we're trying to test.
25 # In some cases, prove will have supplied ./lib as an absolute path so it
26 # doesn't seem worth trying to remove the second copy since it won't hurt
28 use lib qw(t/lib lib);
35 sub { $ENV{PATH} . (kill (0)) },
36 qr/Insecure dependency in kill/,
41 package DBICTest::Taint::Classes;
46 use base qw/DBIx::Class::Schema/;
49 __PACKAGE__->load_classes(qw/Manual/);
50 ok( __PACKAGE__->source('Manual'), 'The Classes::Manual source has been registered' );
51 __PACKAGE__->_unregister_source (qw/Manual/);
52 }, 'Loading classes with explicit load_classes worked in taint mode' );
55 __PACKAGE__->load_classes();
56 ok( __PACKAGE__->source('Auto'), 'The Classes::Auto source has been registered' );
57 ok( __PACKAGE__->source('Auto'), 'The Classes::Manual source has been re-registered' );
58 }, 'Loading classes with Module::Find/load_classes worked in taint mode' );
62 package DBICTest::Taint::Namespaces;
67 use base qw/DBIx::Class::Schema/;
70 __PACKAGE__->load_namespaces();
71 ok( __PACKAGE__->source('Test'), 'The Namespaces::Test source has been registered' );
72 }, 'Loading classes with Module::Find/load_namespaces worked in taint mode' );
75 # check that we can create a database and all
77 my $s = DBICTest->init_schema( sqlite_use_file => 1 );
78 my $art = $s->resultset('Artist')->search({}, {
79 prefetch => 'cds', order_by => 'artistid',
81 is ($art->artistid, 1, 'got artist');