App-PMUtils

 view release on metacpan or  search on metacpan

script/pmxs  view on Meta::CPAN

#!perl

use 5.010;
use strict;
use warnings;

use App::PMUtils;
use Perinci::CmdLine::Any;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2024-08-30'; # DATE
our $DIST = 'App-PMUtils'; # DIST
our $VERSION = '0.745'; # VERSION

our %SPEC;
$SPEC{pmxs} = {
    v => 1.1,
    summary => 'Check whether an installed Perl module is XS/pure-perl',
    args => {
        module => $App::PMUtils::arg_module_multiple,
    },
};
sub pmxs {
    require Module::XSOrPP;

    my %args = @_;

    my $mods = $args{module};
    my $res = [];
    my $found;

    for my $mod (@{$mods}) {
        my $fres = Module::XSOrPP::xs_or_pp($mod);
        $found++ if defined $fres;
        $fres = uc($fres // '?');
        push @$res, @$mods > 1 ? {
            module=>$mod,
            xs=>$fres,
        } : $fres;
    }

    if ($found) {
        [200, "OK", $res];
    } else {
        [404, "No such module"];
    }
}

Perinci::CmdLine::Any->new(
    url => '/main/pmxs',
    read_config => 0,
    read_env => 0,
)->run;

# ABSTRACT: Check whether an installed Perl module is XS/pure-perl
# PODNAME: pmxs

__END__

=pod

=encoding UTF-8

=head1 NAME

pmxs - Check whether an installed Perl module is XS/pure-perl

=head1 VERSION

This document describes version 0.745 of pmxs (from Perl distribution App-PMUtils), released on 2024-08-30.

=head1 SYNOPSIS

Basic usage:

 % pmxs Some::Module

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

=item B<--module-json>=I<s>

See C<--module>.

Can also be specified as the 1st command-line argument and onwards.

=item B<--module>=I<s@>

(No description)


Can also be specified as the 1st command-line argument and onwards.

Can be specified multiple times.

=back

=head2 Output options

=over



( run in 0.602 second using v1.01-cache-2.11-cpan-39bf76dae61 )