From: Peter Rabbitson Date: Thu, 8 Jul 2010 12:35:22 +0000 (+0200) Subject: Cleanup shebang lines of all maint/example scripts, remove from tests entirely X-Git-Tag: v0.08124~117 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class.git;a=commitdiff_plain;h=f54428abf9cc7d7e5604745335694eaf558f6820 Cleanup shebang lines of all maint/example scripts, remove from tests entirely --- diff --git a/Changes b/Changes index cda3bca..31f13e2 100644 --- a/Changes +++ b/Changes @@ -8,6 +8,8 @@ Revision history for DBIx::Class definitions - Implemented add_unique_constraints() which delegates to add_unique_constraint() as appropriate + - dbicadmin now uses a /usr/bin/env shebang to work better with + perlbrew and other local perl builds * Misc - Makefile.PL no longer imports GetOptions() to interoperate better diff --git a/examples/Schema/insertdb.pl b/examples/Schema/insertdb.pl index 67a432f..a701795 100644 --- a/examples/Schema/insertdb.pl +++ b/examples/Schema/insertdb.pl @@ -1,7 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl -use MyDatabase::Main; use strict; +use warnings; + +use MyDatabase::Main; my $schema = MyDatabase::Main->connect('dbi:SQLite:db/example.db'); diff --git a/examples/Schema/testdb.pl b/examples/Schema/testdb.pl index 9ca3e39..c608f45 100644 --- a/examples/Schema/testdb.pl +++ b/examples/Schema/testdb.pl @@ -1,8 +1,10 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl -use MyDatabase::Main; +use warnings; use strict; +use MyDatabase::Main; + my $schema = MyDatabase::Main->connect('dbi:SQLite:db/example.db'); # for other DSNs, e.g. MySql, see the perldoc for the relevant dbd # driver, e.g perldoc L. diff --git a/maint/benchmark_datafetch.pl b/maint/benchmark_datafetch.pl index 94cb8ea..a325aa9 100755 --- a/maint/benchmark_datafetch.pl +++ b/maint/benchmark_datafetch.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use strict; use warnings; diff --git a/maint/benchmark_hashrefinflator.pl b/maint/benchmark_hashrefinflator.pl index 5761051..194e53a 100755 --- a/maint/benchmark_hashrefinflator.pl +++ b/maint/benchmark_hashrefinflator.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # So you wrote a new mk_hash implementation which passed all tests (particularly diff --git a/maint/gen-pod-index.pl b/maint/gen-pod-index.pl index 9d2fbe6..feb758c 100755 --- a/maint/gen-pod-index.pl +++ b/maint/gen-pod-index.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Originally by: Zbigniew Lukasiak, C # but refactored and modified to our nefarious purposes diff --git a/maint/gen-schema.pl b/maint/gen-schema.pl index 907ed11..e3faa85 100755 --- a/maint/gen-schema.pl +++ b/maint/gen-schema.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use strict; use warnings; diff --git a/maint/joint_deps.pl b/maint/joint_deps.pl index 35ef99e..8c16a7d 100755 --- a/maint/joint_deps.pl +++ b/maint/joint_deps.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use warnings; use strict; diff --git a/script/dbicadmin b/script/dbicadmin index a6679e9..16e97fe 100755 --- a/script/dbicadmin +++ b/script/dbicadmin @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use strict; use warnings; diff --git a/t/05components.t b/t/05components.t index 9bd22f5..4595240 100644 --- a/t/05components.t +++ b/t/05components.t @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; use Test::More; diff --git a/t/102load_classes.t b/t/102load_classes.t index e7e82f4..6612ffa 100644 --- a/t/102load_classes.t +++ b/t/102load_classes.t @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; use Test::More; diff --git a/t/30dbicplain.t b/t/30dbicplain.t index f853286..9379e1c 100644 --- a/t/30dbicplain.t +++ b/t/30dbicplain.t @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; use Test::More; diff --git a/t/34exception_action.t b/t/34exception_action.t index 173e435..f76a100 100644 --- a/t/34exception_action.t +++ b/t/34exception_action.t @@ -1,5 +1,5 @@ use strict; -use warnings; +use warnings; use Test::More; use lib qw(t/lib); diff --git a/t/39load_namespaces_1.t b/t/39load_namespaces_1.t index 5798518..d160040 100644 --- a/t/39load_namespaces_1.t +++ b/t/39load_namespaces_1.t @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; use Test::More; diff --git a/t/39load_namespaces_2.t b/t/39load_namespaces_2.t index 5b31c09..77cb9e0 100644 --- a/t/39load_namespaces_2.t +++ b/t/39load_namespaces_2.t @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; use Test::More; diff --git a/t/39load_namespaces_3.t b/t/39load_namespaces_3.t index ebfa87d..c1df868 100644 --- a/t/39load_namespaces_3.t +++ b/t/39load_namespaces_3.t @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; use Test::More; diff --git a/t/39load_namespaces_4.t b/t/39load_namespaces_4.t index 4c7c818..7d9725e 100644 --- a/t/39load_namespaces_4.t +++ b/t/39load_namespaces_4.t @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; use Test::More; diff --git a/t/39load_namespaces_exception.t b/t/39load_namespaces_exception.t index 0606972..c5a03df 100644 --- a/t/39load_namespaces_exception.t +++ b/t/39load_namespaces_exception.t @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; use Test::More; diff --git a/t/39load_namespaces_rt41083.t b/t/39load_namespaces_rt41083.t index 293506b..05378c8 100644 --- a/t/39load_namespaces_rt41083.t +++ b/t/39load_namespaces_rt41083.t @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; diff --git a/t/40resultsetmanager.t b/t/40resultsetmanager.t index 26707f0..66f9598 100644 --- a/t/40resultsetmanager.t +++ b/t/40resultsetmanager.t @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; use Test::More; diff --git a/t/54taint.t b/t/54taint.t index c3df11f..db350d7 100644 --- a/t/54taint.t +++ b/t/54taint.t @@ -1,45 +1,54 @@ -#!perl -T +#!/usr/bin/env perl -T # the above line forces Test::Harness into taint-mode +# DO NOT REMOVE use strict; use warnings; use Test::More; -BEGIN { plan tests => 7 } +use Test::Exception; +use lib qw(t/lib); -package DBICTest::Taint::Classes; +throws_ok ( + sub { $ENV{PATH} . (kill (0)) }, + qr/Insecure dependency in kill/, + 'taint mode active' +); -use Test::More; -use Test::Exception; +{ + package DBICTest::Taint::Classes; -use lib qw(t/lib); -use base qw/DBIx::Class::Schema/; + use Test::More; + use Test::Exception; -lives_ok (sub { - __PACKAGE__->load_classes(qw/Manual/); - ok( __PACKAGE__->source('Manual'), 'The Classes::Manual source has been registered' ); - __PACKAGE__->_unregister_source (qw/Manual/); -}, 'Loading classes with explicit load_classes worked in taint mode' ); + use base qw/DBIx::Class::Schema/; -lives_ok (sub { - __PACKAGE__->load_classes(); - ok( __PACKAGE__->source('Auto'), 'The Classes::Auto source has been registered' ); - ok( __PACKAGE__->source('Auto'), 'The Classes::Manual source has been re-registered' ); -}, 'Loading classes with Module::Find/load_classes worked in taint mode' ); + lives_ok (sub { + __PACKAGE__->load_classes(qw/Manual/); + ok( __PACKAGE__->source('Manual'), 'The Classes::Manual source has been registered' ); + __PACKAGE__->_unregister_source (qw/Manual/); + }, 'Loading classes with explicit load_classes worked in taint mode' ); + lives_ok (sub { + __PACKAGE__->load_classes(); + ok( __PACKAGE__->source('Auto'), 'The Classes::Auto source has been registered' ); + ok( __PACKAGE__->source('Auto'), 'The Classes::Manual source has been re-registered' ); + }, 'Loading classes with Module::Find/load_classes worked in taint mode' ); +} -package DBICTest::Taint::Namespaces; +{ + package DBICTest::Taint::Namespaces; -use Test::More; -use Test::Exception; + use Test::More; + use Test::Exception; -use lib qw(t/lib); -use base qw/DBIx::Class::Schema/; + use base qw/DBIx::Class::Schema/; -lives_ok (sub { - __PACKAGE__->load_namespaces(); - ok( __PACKAGE__->source('Test'), 'The Namespaces::Test source has been registered' ); -}, 'Loading classes with Module::Find/load_namespaces worked in taint mode' ); + lives_ok (sub { + __PACKAGE__->load_namespaces(); + ok( __PACKAGE__->source('Test'), 'The Namespaces::Test source has been registered' ); + }, 'Loading classes with Module::Find/load_namespaces worked in taint mode' ); +} -1; +done_testing; diff --git a/t/94versioning.t b/t/94versioning.t index ad4657e..2e0d18e 100644 --- a/t/94versioning.t +++ b/t/94versioning.t @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; use Test::More; diff --git a/t/cdbi/04-lazy.t b/t/cdbi/04-lazy.t index 60a6d3e..6c9a8d3 100644 --- a/t/cdbi/04-lazy.t +++ b/t/cdbi/04-lazy.t @@ -1,6 +1,5 @@ -#!/usr/bin/perl -w - use strict; +use warnings; use Test::More; use Test::Warn; diff --git a/t/count/in_subquery.t b/t/count/in_subquery.t index e435640..8f56d83 100644 --- a/t/count/in_subquery.t +++ b/t/count/in_subquery.t @@ -1,12 +1,8 @@ -#!/usr/bin/perl - use strict; use warnings; use Test::More; -plan ( tests => 1 ); - use lib qw(t/lib); use DBICTest; use DBIC::SqlMakerTest; @@ -22,3 +18,5 @@ my $schema = DBICTest->init_schema(); my $subsel_rs = $schema->resultset("CD")->search( { cdid => { IN => $squery } } ); is($subsel_rs->count, $rs->count, 'Subselect on PK got the same row count'); } + +done_testing; diff --git a/t/delete/m2m.t b/t/delete/m2m.t index 5613721..de4d3fd 100644 --- a/t/delete/m2m.t +++ b/t/delete/m2m.t @@ -1,7 +1,5 @@ -#!/usr/bin/perl -w - use strict; -use warnings; +use warnings; use Test::More; use lib qw(t/lib); @@ -9,8 +7,6 @@ use DBICTest; my $schema = DBICTest->init_schema(); -plan tests => 5; - my $cd = $schema->resultset("CD")->find(2); ok $cd->liner_notes; ok keys %{$cd->{_relationship_data}}, "_relationship_data populated"; @@ -20,4 +16,6 @@ ok $cd->liner_notes, 'relationships still valid after discarding changes'; ok $cd->liner_notes->delete; $cd->discard_changes; -ok !$cd->liner_notes, 'discard_changes resets relationship'; \ No newline at end of file +ok !$cd->liner_notes, 'discard_changes resets relationship'; + +done_testing; diff --git a/t/discard_changes_in_DESTROY.t b/t/discard_changes_in_DESTROY.t index 946b060..cefcda4 100644 --- a/t/discard_changes_in_DESTROY.t +++ b/t/discard_changes_in_DESTROY.t @@ -1,7 +1,5 @@ -#!/usr/bin/perl -w - use strict; -use warnings; +use warnings; use Test::More; use lib qw(t/lib); @@ -9,8 +7,6 @@ use DBICTest; my $schema = DBICTest->init_schema(); -plan tests => 1; - { my @warnings; local $SIG{__WARN__} = sub { push @warnings, @_; }; @@ -18,15 +14,17 @@ plan tests => 1; # Test that this doesn't cause infinite recursion. local *DBICTest::Artist::DESTROY; local *DBICTest::Artist::DESTROY = sub { $_[0]->discard_changes }; - + my $artist = $schema->resultset("Artist")->create( { artistid => 10, name => "artist number 10", }); - + $artist->name("Wibble"); - + print "# About to call DESTROY\n"; } is_deeply \@warnings, []; -} \ No newline at end of file +} + +done_testing; diff --git a/t/resultset_class.t b/t/resultset_class.t index f43a71e..5aa7a92 100644 --- a/t/resultset_class.t +++ b/t/resultset_class.t @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; use Test::More; @@ -7,7 +5,6 @@ use Class::Inspector (); unshift(@INC, './t/lib'); use lib 't/lib'; -plan tests => 5; use DBICTest; @@ -20,3 +17,5 @@ is(DBICTest::Schema->source('Artist')->resultset_class, 'DBICNSTest::ResultSet:: my $schema = DBICTest->init_schema; my $resultset = $schema->resultset('Artist')->search; isa_ok($resultset, 'DBICNSTest::ResultSet::A', 'resultset is custom class'); + +done_testing; diff --git a/t/resultset_overload.t b/t/resultset_overload.t index c5ecce8..164d2ee 100644 --- a/t/resultset_overload.t +++ b/t/resultset_overload.t @@ -1,5 +1,5 @@ use strict; -use warnings; +use warnings; use Test::More; use lib qw(t/lib); @@ -7,8 +7,6 @@ use DBICTest; my $schema = DBICTest->init_schema(); -plan tests => 6; - { my $rs = $schema->resultset("CD")->search({}); @@ -19,8 +17,10 @@ plan tests => 6; { my $rs = $schema->resultset("CD")->search({ title => "Does not exist" }); - + ok !$rs->count; is $rs, $rs->count, "resultset as number without results"; ok $rs, "resultset as boolean always true"; -} \ No newline at end of file +} + +done_testing; diff --git a/t/search/subquery.t b/t/search/subquery.t index 6dba559..49efcb2 100644 --- a/t/search/subquery.t +++ b/t/search/subquery.t @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; diff --git a/t/storage/dbh_do.t b/t/storage/dbh_do.t index eb8bd20..82e33d8 100644 --- a/t/storage/dbh_do.t +++ b/t/storage/dbh_do.t @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; diff --git a/t/storage/dbi_coderef.t b/t/storage/dbi_coderef.t index 8e174fa..84a0dbc 100644 --- a/t/storage/dbi_coderef.t +++ b/t/storage/dbi_coderef.t @@ -1,5 +1,5 @@ use strict; -use warnings; +use warnings; use Test::More; use lib qw(t/lib); diff --git a/t/storage/dbi_env.t b/t/storage/dbi_env.t index 5ef4274..a22b91c 100644 --- a/t/storage/dbi_env.t +++ b/t/storage/dbi_env.t @@ -1,4 +1,3 @@ -#!/usr/bin/perl use strict; use warnings; use lib qw(t/lib); diff --git a/t/storage/debug.t b/t/storage/debug.t index cb6dd2c..cc27599 100644 --- a/t/storage/debug.t +++ b/t/storage/debug.t @@ -1,5 +1,5 @@ use strict; -use warnings; +use warnings; use Test::More; use lib qw(t/lib); diff --git a/t/storage/disable_sth_caching.t b/t/storage/disable_sth_caching.t index 5ad4cca..860651a 100644 --- a/t/storage/disable_sth_caching.t +++ b/t/storage/disable_sth_caching.t @@ -1,5 +1,5 @@ use strict; -use warnings; +use warnings; use Test::More; use lib qw(t/lib); diff --git a/t/storage/exception.t b/t/storage/exception.t index 9ce05b4..9a14af3 100644 --- a/t/storage/exception.t +++ b/t/storage/exception.t @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; diff --git a/t/storage/ping_count.t b/t/storage/ping_count.t index ed461cd..a17c382 100644 --- a/t/storage/ping_count.t +++ b/t/storage/ping_count.t @@ -1,5 +1,5 @@ use strict; -use warnings; +use warnings; use Test::More; use lib qw(t/lib); diff --git a/t/storage/reconnect.t b/t/storage/reconnect.t index 5ef22f2..eca17cf 100644 --- a/t/storage/reconnect.t +++ b/t/storage/reconnect.t @@ -1,5 +1,5 @@ use strict; -use warnings; +use warnings; use FindBin; use File::Copy; diff --git a/t/storage/stats.t b/t/storage/stats.t index 4cd85a0..c164399 100644 --- a/t/storage/stats.t +++ b/t/storage/stats.t @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; use Test::More;