Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relies on formatter to inherit from Exporter #17

Open
ikegami opened this issue Jul 13, 2021 · 0 comments
Open

Relies on formatter to inherit from Exporter #17

ikegami opened this issue Jul 13, 2021 · 0 comments

Comments

@ikegami
Copy link

ikegami commented Jul 13, 2021

Most modules that export symbols use Exporter. This is what Pod::Usage uses to export pod2usage.

There are two ways to use Exporter:

  1. Inherit from it.

    use Exporter;
    our @EXPORT = qw( pod2usage );
    our @ISA = qw( Exporter );
  2. Import import from it.

    use Exporter qw( import );
    our @EXPORT = qw( pod2usage );

This is what Pod::Usage does:

use Exporter;
our @EXPORT = qw( pod2usage );
our @ISA = $Pod::Usage::Formatter;

This works if the formatter inherits from Exporter (such as Pod::Text), but it fails if the formatter doesn't. This is the case for Pod::Man.

Fix

Replace

use Exporter;

with

use Exporter qw( import );

or replace

@ISA = ( $Pod::Usage::Formatter );

with

@ISA = ( $Pod::Usage::Formatter, 'Exporter' );

Workaround

Until fixed, one can use the following:

BEGIN { $Pod::Usage::Formatter = '...'; }
package Pod::Usage { use Exporter qw( import ); }
use Pod::Usage qw( pod2usage );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant