From: Justin Hunter Date: Mon, 9 May 2011 20:14:31 +0000 (-0700) Subject: turn 'use vars' into 'our' X-Git-Tag: v0.08192~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f9cc85ce4c60c87d559247e28fe9a5f2ec18992c;p=dbsrgits%2FDBIx-Class.git turn 'use vars' into 'our' move the $VERSION up to the top of DBIx/Class.pm to aid in version detection (things like Module::Metadata find the $VERSION string and base it on the last package statement it has seen, not knowing that } 'ends' the package) --- diff --git a/lib/DBIx/Class.pm b/lib/DBIx/Class.pm index 220ba73..f9cf49a 100644 --- a/lib/DBIx/Class.pm +++ b/lib/DBIx/Class.pm @@ -3,6 +3,18 @@ package DBIx::Class; use strict; use warnings; +our $VERSION; +# Always remember to do all digits for the version even if they're 0 +# i.e. first release of 0.XX *must* be 0.XX000. This avoids fBSD ports +# brain damage and presumably various other packaging systems too + +# $VERSION declaration must stay up here, ahead of any other package +# declarations, as to not confuse various modules attempting to determine +# this ones version, whether that be s.c.o. or Module::Metadata, etc +$VERSION = '0.08191'; + +$VERSION = eval $VERSION if $VERSION =~ /_/; # numify for warning-free dev releases + BEGIN { package DBIx::Class::_ENV_; @@ -54,7 +66,6 @@ use mro 'c3'; use DBIx::Class::Optional::Dependencies; -use vars qw($VERSION); use base qw/DBIx::Class::Componentised DBIx::Class::AccessorGroup/; use DBIx::Class::StartupCheck; @@ -73,13 +84,6 @@ sub mk_classaccessor { sub component_base_class { 'DBIx::Class' } -# Always remember to do all digits for the version even if they're 0 -# i.e. first release of 0.XX *must* be 0.XX000. This avoids fBSD ports -# brain damage and presumably various other packaging systems too -$VERSION = '0.08191'; - -$VERSION = eval $VERSION if $VERSION =~ /_/; # numify for warning-free dev releases - sub MODIFY_CODE_ATTRIBUTES { my ($class,$code,@attrs) = @_; $class->mk_classdata('__attr_cache' => {}) diff --git a/lib/SQL/Translator/Parser/DBIx/Class.pm b/lib/SQL/Translator/Parser/DBIx/Class.pm index 06b5548..5a7f7c9 100644 --- a/lib/SQL/Translator/Parser/DBIx/Class.pm +++ b/lib/SQL/Translator/Parser/DBIx/Class.pm @@ -8,7 +8,7 @@ package SQL::Translator::Parser::DBIx::Class; use strict; use warnings; -use vars qw($DEBUG $VERSION @EXPORT_OK); +our ($DEBUG, $VERSION, @EXPORT_OK); $VERSION = '1.10'; $DEBUG = 0 unless defined $DEBUG; diff --git a/lib/SQL/Translator/Producer/DBIx/Class/File.pm b/lib/SQL/Translator/Producer/DBIx/Class/File.pm index 5099a13..0af77d7 100644 --- a/lib/SQL/Translator/Producer/DBIx/Class/File.pm +++ b/lib/SQL/Translator/Producer/DBIx/Class/File.pm @@ -19,7 +19,7 @@ Creates a DBIx::Class::Schema for use with DBIx::Class =cut use strict; -use vars qw[ $VERSION $DEBUG $WARN ]; +our ($VERSION, $DEBUG, $WARN); $VERSION = '0.1'; $DEBUG = 0 unless defined $DEBUG; diff --git a/t/cdbi/12-filter.t b/t/cdbi/12-filter.t index 109c876..cecc64c 100644 --- a/t/cdbi/12-filter.t +++ b/t/cdbi/12-filter.t @@ -149,7 +149,7 @@ test_normal_iterator; package Class::DBI::My::Iterator; -use vars qw/@ISA/; +our @ISA; @ISA = ($it_class); diff --git a/t/cdbi/testlib/MyBase.pm b/t/cdbi/testlib/MyBase.pm index aab76fe..6821a39 100644 --- a/t/cdbi/testlib/MyBase.pm +++ b/t/cdbi/testlib/MyBase.pm @@ -6,7 +6,7 @@ use base qw(DBIx::Class::CDBICompat); use DBI; -use vars qw/$dbh/; +our $dbh; my @connect = (@ENV{map { "DBICTEST_MYSQL_${_}" } qw/DSN USER PASS/}, { PrintError => 0}); $dbh = DBI->connect(@connect) or die DBI->errstr;