CPAN::Command::Bugtracker - Adds a 'bugtracker' command to the CPAN shell


CPAN-Command documentation Contained in the CPAN-Command distribution.

Index


Code Index:

NAME

Top

CPAN::Command::Bugtracker - Adds a 'bugtracker' command to the CPAN shell

VERSION

Top

version 1.100840

SYNOPSIS

Top

    # sudo perl -MCPAN::Command -e 'CPAN::shell()'
    # cpan> bugtracker Foo::Bar

DESCRIPTION

Top

This is a plugin for CPAN::Command which adds a bugtracker command to the CPAN shell. The command expects a module name and opens the web page for the distribution's bug tracker, if one is set in the distribution's META.yml file.

Currently opening the web page is done with the open(1) command, so it will probably only work with Mac OS X. Patches for other operating systems are welcome.

INSTALLATION

Top

See perlmodinstall for information and options on installing Perl modules.

BUGS AND LIMITATIONS

Top

No bugs have been reported.

Please report any bugs or feature requests through the web interface at http://rt.cpan.org/Public/Dist/Display.html?Name=CPAN-Command.

AVAILABILITY

Top

The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit http://www.perl.com/CPAN/ to find a CPAN site near you, or see http://search.cpan.org/dist/CPAN-Command/.

The development version lives at http://github.com/hanekomu/CPAN-Command/. Instead of sending patches, please fork this project using the standard git and github infrastructure.

AUTHOR

Top

  Marcel Gruenauer <marcel@cpan.org>

COPYRIGHT AND LICENSE

Top


CPAN-Command documentation Contained in the CPAN-Command distribution.

use 5.008_001;
use strict;
use warnings;

package CPAN::Command::Bugtracker;
our $VERSION = '1.100840';
# ABSTRACT: Adds a 'bugtracker' command to the CPAN shell
use CPAN;    # so it can be used with CPAN::Commander or standalone
use Regexp::Common qw(URI);
use URI;
push @CPAN::Complete::COMMANDS, qw( bugtracker );
$CPAN::Shell::Help->{bugtracker} = "open a distribution's bug tracker web page";
sub CPAN::Shell::bugtracker { shift->rematein('bugtracker', @_) }
sub CPAN::Module::bugtracker { shift->rematein('bugtracker') }

sub CPAN::Distribution::bugtracker {
    my $self = shift;
    $self->get;
    my $package = $self->called_for;
    my $meta    = $self->parse_meta_yml;
    my $url     = $meta->{resources}{bugtracker}
      or return $CPAN::Frontend->mywarn(
        "$package doesn't have a bugtracker set in META.yml");
    if ($url =~ /^$RE{URI}{HTTP}$/) {
        system("open $url");
    } else {
        $CPAN::Frontend->mywarn("$url doesn't look like a URI");
    }
}
1;


__END__