CPAN-Info-FromRepoName

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

{
   "abstract" : "Extract/guess information from a repo name",
   "author" : [
      "perlancar <perlancar@cpan.org>"
   ],
   "dynamic_config" : 0,
   "generated_by" : "Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010",
   "license" : [
      "perl_5"
   ],
   "meta-spec" : {
      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",

META.yml  view on Meta::CPAN

---
abstract: 'Extract/guess information from a repo name'
author:
  - 'perlancar <perlancar@cpan.org>'
build_requires:
  File::Spec: '0'
  IO::Handle: '0'
  IPC::Open3: '0'
  Test::More: '0'
configure_requires:
  ExtUtils::MakeMaker: '0'
dynamic_config: 0

Makefile.PL  view on Meta::CPAN

# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.012.
use strict;
use warnings;

use 5.010001;

use ExtUtils::MakeMaker;

my %WriteMakefileArgs = (
  "ABSTRACT" => "Extract/guess information from a repo name",
  "AUTHOR" => "perlancar <perlancar\@cpan.org>",
  "CONFIGURE_REQUIRES" => {
    "ExtUtils::MakeMaker" => 0
  },
  "DISTNAME" => "CPAN-Info-FromRepoName",
  "LICENSE" => "perl",
  "MIN_PERL_VERSION" => "5.010001",
  "NAME" => "CPAN::Info::FromRepoName",
  "PREREQ_PM" => {
    "Exporter" => "5.57",

README  view on Meta::CPAN

NAME
    CPAN::Info::FromRepoName - Extract/guess information from a repo name

VERSION
    This document describes version 0.001 of CPAN::Info::FromRepoName (from
    Perl distribution CPAN-Info-FromRepoName), released on 2020-10-02.

FUNCTIONS
  extract_cpan_info_from_repo_name
    Usage:

     extract_cpan_info_from_repo_name($repo_name) -> hash

    Extract/guess information from a repo name.

    Examples:

    *   Example #1 (perl-<dist>):

         extract_cpan_info_from_repo_name("perl-Foo-Bar"); # -> { dist => "Foo-Bar" }

    *   Example #2 (p5-<dist>):

         extract_cpan_info_from_repo_name("perl-Foo-Bar"); # -> { dist => "Foo-Bar" }

README  view on Meta::CPAN


    *   Example #7 (<dist>):

         extract_cpan_info_from_repo_name("CPAN-Foo-Bar"); # -> { dist => "CPAN-Foo-Bar" }

    *   Example #8 (unknown):

         extract_cpan_info_from_repo_name("\@foo"); # -> undef

    Guess information from a repo name and return a hash (or undef if
    nothing can be guessed). Possible keys include "dist" (Perl distribution
    name).

    This function is not exported by default, but exportable.

    Arguments ('*' denotes required arguments):

    *   $repo_name* => *str*

    Return value: (hash)

lib/CPAN/Info/FromRepoName.pm  view on Meta::CPAN

our $re_end_or_q = qr/(?:[?&#]|\z)/;

sub _normalize_mod {
    my $mod = shift;
    $mod =~ s/'/::/g;
    $mod;
}

$SPEC{extract_cpan_info_from_repo_name} = {
    v => 1.1,
    summary => 'Extract/guess information from a repo name',
    description => <<'_',

Guess information from a repo name and return a hash (or undef if nothing can be
guessed). Possible keys include `dist` (Perl distribution name).

_
    args => {
        repo_name => {
            schema => 'str*',
            req => 1,
            pos => 0,
        },
    },
    args_as => 'array',

lib/CPAN/Info/FromRepoName.pm  view on Meta::CPAN

        $res->{dist} = $1;
    } elsif ($repo_name =~ /\A($re_distname)-(?:perl|p5|cpan)\z/) {
        $res->{dist} = $1;
    } elsif ($repo_name =~ /\A($re_distname)\z/) {
        $res->{dist} = $1;
    }
    $res;
}

1;
# ABSTRACT: Extract/guess information from a repo name

__END__

=pod

=encoding UTF-8

=head1 NAME

CPAN::Info::FromRepoName - Extract/guess information from a repo name

=head1 VERSION

This document describes version 0.001 of CPAN::Info::FromRepoName (from Perl distribution CPAN-Info-FromRepoName), released on 2020-10-02.

=head1 FUNCTIONS


=head2 extract_cpan_info_from_repo_name

Usage:

 extract_cpan_info_from_repo_name($repo_name) -> hash

ExtractE<sol>guess information from a repo name.

Examples:

=over

=item * Example #1 (perl-<distE<gt>):

 extract_cpan_info_from_repo_name("perl-Foo-Bar"); # -> { dist => "Foo-Bar" }

=item * Example #2 (p5-<distE<gt>):

lib/CPAN/Info/FromRepoName.pm  view on Meta::CPAN


 extract_cpan_info_from_repo_name("CPAN-Foo-Bar"); # -> { dist => "CPAN-Foo-Bar" }

=item * Example #8 (unknown):

 extract_cpan_info_from_repo_name("\@foo"); # -> undef

=back

Guess information from a repo name and return a hash (or undef if nothing can be
guessed). Possible keys include C<dist> (Perl distribution name).

This function is not exported by default, but exportable.

Arguments ('*' denotes required arguments):

=over 4

=item * B<$repo_name>* => I<str>


lib/CPAN/Module/FromRepoName.pm  view on Meta::CPAN


use CPAN::Info::FromRepoName qw(extract_cpan_info_from_repo_name);

use Exporter qw(import);
our @EXPORT_OK = qw(extract_cpan_module_from_repo_name);

our %SPEC;

$SPEC{extract_cpan_module_from_repo_name} = {
    v => 1.1,
    summary => 'Extract/guess CPAN module from a repo name',
    args => {
        repo_name => {
            schema => 'str*',
            req => 1,
            pos => 0,
        },
    },
    args_as => 'array',
    result => {
        schema => 'str',

lib/CPAN/Module/FromRepoName.pm  view on Meta::CPAN

    return undef unless $ecires;
    return $ecires->{module} if defined $ecires->{module};
    if (defined(my $mod = $ecires->{dist})) {
        $mod =~ s/-/::/g;
        return $mod;
    }
    undef;
}

1;
# ABSTRACT: Extract/guess CPAN module from a repo name

__END__

=pod

=encoding UTF-8

=head1 NAME

CPAN::Module::FromRepoName - Extract/guess CPAN module from a repo name

=head1 VERSION

This document describes version 0.001 of CPAN::Module::FromRepoName (from Perl distribution CPAN-Info-FromRepoName), released on 2020-10-02.

=head1 FUNCTIONS


=head2 extract_cpan_module_from_repo_name

Usage:

 extract_cpan_module_from_repo_name($repo_name) -> str

ExtractE<sol>guess CPAN module from a repo name.

Examples:

=over

=item * Example #1 (perl-<distE<gt>):

 extract_cpan_module_from_repo_name("perl-Foo-Bar"); # -> "Foo::Bar"

=item * Example #2 (unknown):



( run in 2.736 seconds using v1.01-cache-2.11-cpan-748bfb374f4 )