Skip to content

Commit

Permalink
Merge pull request #121 from JRaspass/master
Browse files Browse the repository at this point in the history
Replace "use vars" with "our"
  • Loading branch information
Tux authored Aug 19, 2024
2 parents 961df72 + 860c8b8 commit cf3be4e
Show file tree
Hide file tree
Showing 32 changed files with 169 additions and 239 deletions.
27 changes: 13 additions & 14 deletions DBI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ package DBI;

require 5.008_001;

use strict;
use warnings;

our ($XS_VERSION, $VERSION);
BEGIN {
our $XS_VERSION = our $VERSION = "1.644"; # ==> ALSO update the version in the pod text below!
$XS_VERSION = $VERSION = "1.644"; # ==> ALSO update the version in the pod text below!
$VERSION = eval $VERSION;
}

Expand Down Expand Up @@ -175,6 +179,7 @@ use Carp();
use XSLoader ();
use Exporter ();

our (@ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
BEGIN {
@ISA = qw(Exporter);

Expand Down Expand Up @@ -276,7 +281,7 @@ else {
XSLoader::load( 'DBI', $XS_VERSION);
}

$EXPORT_TAGS{preparse_flags} = [ grep { /^DBIpp_\w\w_/ } keys %{__PACKAGE__."::"} ];
$EXPORT_TAGS{preparse_flags} = [ grep { /^DBIpp_\w\w_/ } keys %DBI:: ];

Exporter::export_ok_tags(keys %EXPORT_TAGS);

Expand All @@ -288,9 +293,6 @@ for (qw(trace_msg set_err parse_trace_flag parse_trace_flags)) {
*$_ = \&{"DBD::_::common::$_"};
}

use strict;
use warnings;

DBI->trace(split /=/, $ENV{DBI_TRACE}, 2) if $ENV{DBI_TRACE};

$DBI::connect_via ||= "connect";
Expand Down Expand Up @@ -1451,7 +1453,7 @@ sub _new_sth { # called by DBD::<drivername>::db::prepare)

{ package # hide from PAUSE
DBD::_::dr; # ====== DRIVER ======
@DBD::_::dr::ISA = qw(DBD::_::common);
our @ISA = qw(DBD::_::common);
use strict;

sub default_user {
Expand Down Expand Up @@ -1516,7 +1518,7 @@ sub _new_sth { # called by DBD::<drivername>::db::prepare)

{ package # hide from PAUSE
DBD::_::db; # ====== DATABASE ======
@DBD::_::db::ISA = qw(DBD::_::common);
our @ISA = qw(DBD::_::common);
use strict;

sub clone {
Expand Down Expand Up @@ -1838,7 +1840,7 @@ sub _new_sth { # called by DBD::<drivername>::db::prepare)

{ package # hide from PAUSE
DBD::_::st; # ====== STATEMENT ======
@DBD::_::st::ISA = qw(DBD::_::common);
our @ISA = qw(DBD::_::common);
use strict;

sub bind_param { Carp::croak("Can't bind_param, not implement by driver") }
Expand Down Expand Up @@ -7697,12 +7699,10 @@ can be found in F<t/subclass.t> in the DBI distribution.
use strict;
use DBI;
use vars qw(@ISA);
@ISA = qw(DBI);
our @ISA = qw(DBI);
package MySubDBI::db;
use vars qw(@ISA);
@ISA = qw(DBI::db);
our @ISA = qw(DBI::db);
sub prepare {
my ($dbh, @args) = @_;
Expand All @@ -7713,8 +7713,7 @@ can be found in F<t/subclass.t> in the DBI distribution.
}
package MySubDBI::st;
use vars qw(@ISA);
@ISA = qw(DBI::st);
our @ISA = qw(DBI::st);
sub fetch {
my ($sth, @args) = @_;
Expand Down
9 changes: 3 additions & 6 deletions doc/DBI.3
Original file line number Diff line number Diff line change
Expand Up @@ -6242,12 +6242,10 @@ can be found in \fIt/subclass.t\fR in the DBI distribution.
\& use strict;
\&
\& use DBI;
\& use vars qw(@ISA);
\& @ISA = qw(DBI);
\& our @ISA = qw(DBI);
\&
\& package MySubDBI::db;
\& use vars qw(@ISA);
\& @ISA = qw(DBI::db);
\& our @ISA = qw(DBI::db);
\&
\& sub prepare {
\& my ($dbh, @args) = @_;
Expand All @@ -6258,8 +6256,7 @@ can be found in \fIt/subclass.t\fR in the DBI distribution.
\& }
\&
\& package MySubDBI::st;
\& use vars qw(@ISA);
\& @ISA = qw(DBI::st);
\& our @ISA = qw(DBI::st);
\&
\& sub fetch {
\& my ($sth, @args) = @_;
Expand Down
9 changes: 3 additions & 6 deletions doc/DBI.html
Original file line number Diff line number Diff line change
Expand Up @@ -4059,12 +4059,10 @@ <h2 id="Subclassing-the-DBI">Subclassing the DBI</h2>
use strict;

use DBI;
use vars qw(@ISA);
@ISA = qw(DBI);
our @ISA = qw(DBI);

package MySubDBI::db;
use vars qw(@ISA);
@ISA = qw(DBI::db);
our @ISA = qw(DBI::db);

sub prepare {
my ($dbh, @args) = @_;
Expand All @@ -4075,8 +4073,7 @@ <h2 id="Subclassing-the-DBI">Subclassing the DBI</h2>
}

package MySubDBI::st;
use vars qw(@ISA);
@ISA = qw(DBI::st);
our @ISA = qw(DBI::st);

sub fetch {
my ($sth, @args) = @_;
Expand Down
9 changes: 3 additions & 6 deletions doc/DBI.md
Original file line number Diff line number Diff line change
Expand Up @@ -5607,12 +5607,10 @@ can be found in `t/subclass.t` in the DBI distribution.
use strict;

use DBI;
use vars qw(@ISA);
@ISA = qw(DBI);
our @ISA = qw(DBI);

package MySubDBI::db;
use vars qw(@ISA);
@ISA = qw(DBI::db);
our @ISA = qw(DBI::db);

sub prepare {
my ($dbh, @args) = @_;
Expand All @@ -5623,8 +5621,7 @@ can be found in `t/subclass.t` in the DBI distribution.
}

package MySubDBI::st;
use vars qw(@ISA);
@ISA = qw(DBI::st);
our @ISA = qw(DBI::st);

sub fetch {
my ($sth, @args) = @_;
Expand Down
9 changes: 4 additions & 5 deletions doc/DBI::DBD.3
Original file line number Diff line number Diff line change
Expand Up @@ -659,9 +659,8 @@ The header
\& package DBD::File;
\&
\& use strict;
\& use vars qw($VERSION $drh);
\&
\& $VERSION = "1.23.00" # Version number of DBD::File
\& our $VERSION = "1.23.00" # Version number of DBD::File
.Ve
.PP
This is where the version number of your driver is specified, and is
Expand All @@ -678,22 +677,22 @@ very common).
For Subversion you could use:
.PP
.Vb 1
\& $VERSION = "12.012346";
\& our $VERSION = "12.012346";
.Ve
.PP
(use lots of leading zeros on the second portion so if you move the code to a
shared repository like svn.perl.org the much larger revision numbers won\*(Aqt
cause a problem, at least not for a few years). For RCS or CVS you can use:
.PP
.Vb 1
\& $VERSION = "11.22";
\& our $VERSION = "11.22";
.Ve
.PP
which pads out the fractional part with leading zeros so all is well
(so long as you don\*(Aqt go past x.99)
.PP
.Vb 1
\& $drh = undef; # holds driver handle once initialized
\& our $drh = undef; # holds driver handle once initialized
.Ve
.PP
This is where the driver handle will be stored, once created.
Expand Down
9 changes: 4 additions & 5 deletions doc/DBI::DBD.html
Original file line number Diff line number Diff line change
Expand Up @@ -621,25 +621,24 @@ <h4 id="The-header">The header</h4>
<pre><code>package DBD::File;

use strict;
use vars qw($VERSION $drh);

$VERSION = &quot;1.23.00&quot; # Version number of DBD::File</code></pre>
our $VERSION = &quot;1.23.00&quot; # Version number of DBD::File</code></pre>

<p>This is where the version number of your driver is specified, and is where <i>Makefile.PL</i> looks for this information. Please ensure that any other modules added with your driver are also version stamped so that CPAN does not get confused.</p>

<p>It is recommended that you use a two-part (1.23) or three-part (1.23.45) version number. Also consider the CPAN system, which gets confused and considers version 1.10 to precede version 1.9, so that using a raw CVS, RCS or SCCS version number is probably not appropriate (despite being very common).</p>

<p>For Subversion you could use:</p>

<pre><code>$VERSION = &quot;12.012346&quot;;</code></pre>
<pre><code>our $VERSION = &quot;12.012346&quot;;</code></pre>

<p>(use lots of leading zeros on the second portion so if you move the code to a shared repository like svn.perl.org the much larger revision numbers won&#39;t cause a problem, at least not for a few years). For RCS or CVS you can use:</p>

<pre><code>$VERSION = &quot;11.22&quot;;</code></pre>
<pre><code>our $VERSION = &quot;11.22&quot;;</code></pre>

<p>which pads out the fractional part with leading zeros so all is well (so long as you don&#39;t go past x.99)</p>

<pre><code>$drh = undef; # holds driver handle once initialized</code></pre>
<pre><code>our $drh = undef; # holds driver handle once initialized</code></pre>

<p>This is where the driver handle will be stored, once created. Note that you may assume there is only one handle for your driver.</p>

Expand Down
9 changes: 4 additions & 5 deletions doc/DBI::DBD.md
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,8 @@ or really specific to the **DBD::File** package.
package DBD::File;

use strict;
use vars qw($VERSION $drh);

$VERSION = "1.23.00" # Version number of DBD::File
our $VERSION = "1.23.00" # Version number of DBD::File

This is where the version number of your driver is specified, and is
where `Makefile.PL` looks for this information. Please ensure that any
Expand All @@ -590,18 +589,18 @@ very common).

For Subversion you could use:

$VERSION = "12.012346";
our $VERSION = "12.012346";

(use lots of leading zeros on the second portion so if you move the code to a
shared repository like svn.perl.org the much larger revision numbers won't
cause a problem, at least not for a few years). For RCS or CVS you can use:

$VERSION = "11.22";
our $VERSION = "11.22";

which pads out the fractional part with leading zeros so all is well
(so long as you don't go past x.99)

$drh = undef; # holds driver handle once initialized
our $drh = undef; # holds driver handle once initialized

This is where the driver handle will be stored, once created.
Note that you may assume there is only one handle for your driver.
Expand Down
10 changes: 5 additions & 5 deletions doc/DBI::DBD::SqlEngine.3
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ DBI::DBD::SqlEngine \- Base class for DBI drivers without their own SQL engine
\&
\& package DBD::myDriver::dr;
\&
\& @ISA = qw(DBI::DBD::SqlEngine::dr);
\& our @ISA = qw(DBI::DBD::SqlEngine::dr);
\&
\& sub data_sources { ... }
\& ...
\&
\& package DBD::myDriver::db;
\&
\& @ISA = qw(DBI::DBD::SqlEngine::db);
\& our @ISA = qw(DBI::DBD::SqlEngine::db);
\&
\& sub init_valid_attributes { ... }
\& sub init_default_attributes { ... }
Expand All @@ -101,20 +101,20 @@ DBI::DBD::SqlEngine \- Base class for DBI drivers without their own SQL engine
\&
\& package DBD::myDriver::st;
\&
\& @ISA = qw(DBI::DBD::SqlEngine::st);
\& our @ISA = qw(DBI::DBD::SqlEngine::st);
\&
\& sub FETCH { ... }
\& sub STORE { ... }
\&
\& package DBD::myDriver::Statement;
\&
\& @ISA = qw(DBI::DBD::SqlEngine::Statement);
\& our @ISA = qw(DBI::DBD::SqlEngine::Statement);
\&
\& sub open_table { ... }
\&
\& package DBD::myDriver::Table;
\&
\& @ISA = qw(DBI::DBD::SqlEngine::Table);
\& our @ISA = qw(DBI::DBD::SqlEngine::Table);
\&
\& sub new { ... }
.Ve
Expand Down
10 changes: 5 additions & 5 deletions doc/DBI::DBD::SqlEngine.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ <h1 id="SYNOPSIS">SYNOPSIS</h1>

package DBD::myDriver::dr;

@ISA = qw(DBI::DBD::SqlEngine::dr);
our @ISA = qw(DBI::DBD::SqlEngine::dr);

sub data_sources { ... }
...

package DBD::myDriver::db;

@ISA = qw(DBI::DBD::SqlEngine::db);
our @ISA = qw(DBI::DBD::SqlEngine::db);

sub init_valid_attributes { ... }
sub init_default_attributes { ... }
Expand All @@ -128,20 +128,20 @@ <h1 id="SYNOPSIS">SYNOPSIS</h1>

package DBD::myDriver::st;

@ISA = qw(DBI::DBD::SqlEngine::st);
our @ISA = qw(DBI::DBD::SqlEngine::st);

sub FETCH { ... }
sub STORE { ... }

package DBD::myDriver::Statement;

@ISA = qw(DBI::DBD::SqlEngine::Statement);
our @ISA = qw(DBI::DBD::SqlEngine::Statement);

sub open_table { ... }

package DBD::myDriver::Table;

@ISA = qw(DBI::DBD::SqlEngine::Table);
our @ISA = qw(DBI::DBD::SqlEngine::Table);

sub new { ... }</code></pre>

Expand Down
10 changes: 5 additions & 5 deletions doc/DBI::DBD::SqlEngine.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ DBI::DBD::SqlEngine - Base class for DBI drivers without their own SQL engine

package DBD::myDriver::dr;

@ISA = qw(DBI::DBD::SqlEngine::dr);
our @ISA = qw(DBI::DBD::SqlEngine::dr);

sub data_sources { ... }
...

package DBD::myDriver::db;

@ISA = qw(DBI::DBD::SqlEngine::db);
our @ISA = qw(DBI::DBD::SqlEngine::db);

sub init_valid_attributes { ... }
sub init_default_attributes { ... }
Expand All @@ -37,20 +37,20 @@ DBI::DBD::SqlEngine - Base class for DBI drivers without their own SQL engine

package DBD::myDriver::st;

@ISA = qw(DBI::DBD::SqlEngine::st);
our @ISA = qw(DBI::DBD::SqlEngine::st);

sub FETCH { ... }
sub STORE { ... }

package DBD::myDriver::Statement;

@ISA = qw(DBI::DBD::SqlEngine::Statement);
our @ISA = qw(DBI::DBD::SqlEngine::Statement);

sub open_table { ... }

package DBD::myDriver::Table;

@ISA = qw(DBI::DBD::SqlEngine::Table);
our @ISA = qw(DBI::DBD::SqlEngine::Table);

sub new { ... }

Expand Down
Loading

0 comments on commit cf3be4e

Please sign in to comment.