Skip to content

Commit

Permalink
Modernize exports and inheritance
Browse files Browse the repository at this point in the history
Declare parent classes with use parent, now that we can require
Perl 5.12 or later. Do not inherit from Exporter; instead, just
import the import function from the Exporter class.
  • Loading branch information
rra committed Mar 17, 2024
1 parent 437518f commit fcb38c6
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 24 deletions.
4 changes: 1 addition & 3 deletions lib/Pod/Man.pm
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
package Pod::Man v6.0.0;

use 5.012;
use parent qw(Pod::Simple);
use warnings;

use Carp qw(carp croak);
use Pod::Simple ();

# Conditionally import Encode and set $HAS_ENCODE if it is available. This is
# required to support building as part of Perl core, since podlators is built
Expand All @@ -29,8 +29,6 @@ BEGIN {
$HAS_ENCODE = eval { require Encode };
}

our @ISA = qw(Pod::Simple);

# Ensure that $Pod::Simple::nbsp and $Pod::Simple::shy are available. Code
# taken from Pod::Simple 3.32, but was only added in 3.30.
my ($NBSP, $SHY);
Expand Down
3 changes: 1 addition & 2 deletions lib/Pod/ParseLink.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ package Pod::ParseLink v6.0.0;
use 5.012;
use warnings;

use Exporter;
use Exporter qw(import);

our @ISA = qw(Exporter);
our @EXPORT = qw(parselink);

##############################################################################
Expand Down
6 changes: 2 additions & 4 deletions lib/Pod/Text.pm
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
package Pod::Text v6.0.0;

use 5.012;
use parent qw(Pod::Simple);
use warnings;

use Carp qw(carp croak);
use Encode qw(encode);
use Exporter ();
use Pod::Simple ();

our @ISA = qw(Pod::Simple Exporter);
use Exporter qw(import);

# We have to export pod2text for backward compatibility.
our @EXPORT = qw(pod2text);
Expand Down
4 changes: 1 addition & 3 deletions lib/Pod/Text/Color.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@
package Pod::Text::Color v6.0.0;

use 5.012;
use parent qw(Pod::Text);
use warnings;

use Pod::Text ();
use Term::ANSIColor qw(color colored);

our @ISA = qw(Pod::Text);

##############################################################################
# Overrides
##############################################################################
Expand Down
5 changes: 1 addition & 4 deletions lib/Pod/Text/Overstrike.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@
package Pod::Text::Overstrike v6.0.0;

use 5.012;
use parent qw(Pod::Text);
use warnings;

use Pod::Text ();

our @ISA = qw(Pod::Text);

##############################################################################
# Overrides
##############################################################################
Expand Down
4 changes: 1 addition & 3 deletions lib/Pod/Text/Termcap.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@
package Pod::Text::Termcap v6.0.0;

use 5.012;
use parent qw(Pod::Text);
use warnings;

use Pod::Text ();
use POSIX ();
use Term::Cap;

our @ISA = qw(Pod::Text);

##############################################################################
# Overrides
##############################################################################
Expand Down
3 changes: 1 addition & 2 deletions t/lib/Test/Podlators.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
package Test::Podlators v6.0.0;

use 5.012;
use base qw(Exporter);
use warnings;

use Encode qw(decode encode);
use Exporter;
use Exporter qw(import);
use File::Spec;
use Test::More;

Expand Down
2 changes: 1 addition & 1 deletion t/lib/Test/RRA.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ package Test::RRA v11.0.0;

use 5.012;
use autodie;
use base qw(Exporter);
use warnings;

use Carp qw(croak);
use Exporter qw(import);
use File::Temp;

# Abort if Test::More was loaded before Test::RRA to be sure that we get the
Expand Down
2 changes: 1 addition & 1 deletion t/lib/Test/RRA/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
package Test::RRA::Config v11.0.0;

use 5.012;
use base qw(Exporter);
use warnings;

use Exporter qw(import);
use Test::More;

# Exports.
Expand Down
2 changes: 1 addition & 1 deletion t/lib/Test/RRA/ModuleVersion.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ package Test::RRA::ModuleVersion v11.0.0;

use 5.012;
use autodie;
use base qw(Exporter);
use warnings;

use Exporter qw(import);
use File::Find qw(find);
use Test::More;
use Test::RRA::Config qw(@MODULE_VERSION_IGNORE);
Expand Down

0 comments on commit fcb38c6

Please sign in to comment.