Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package perl-App-perlbrew for 
openSUSE:Factory checked in at 2023-09-13 20:44:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-App-perlbrew (Old)
 and      /work/SRC/openSUSE:Factory/.perl-App-perlbrew.new.1766 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-App-perlbrew"

Wed Sep 13 20:44:09 2023 rev:33 rq:1110645 version:0.980.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-App-perlbrew/perl-App-perlbrew.changes      
2023-06-03 00:07:16.934009671 +0200
+++ 
/work/SRC/openSUSE:Factory/.perl-App-perlbrew.new.1766/perl-App-perlbrew.changes
    2023-09-13 20:44:52.310737126 +0200
@@ -1,0 +2,12 @@
+Sat Aug 12 03:06:40 UTC 2023 - Tina Müller <timueller+p...@suse.de>
+
+- updated to 0.98
+   see /usr/share/doc/packages/perl-App-perlbrew/Changes
+
+  0.98
+       - Released at 2023-08-11T22:54:38+0900
+       - Remove the support of cperl from `available` and `install` command. 
Github PR: #777. cperl can still be installed by specifying the tarball, just 
not by their short names.
+       - new command: make-shim
+       - new command: make-pp.
+
+-------------------------------------------------------------------

Old:
----
  App-perlbrew-0.97.tar.gz

New:
----
  App-perlbrew-0.98.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-App-perlbrew.spec ++++++
--- /var/tmp/diff_new_pack.SukXq1/_old  2023-09-13 20:44:53.302772394 +0200
+++ /var/tmp/diff_new_pack.SukXq1/_new  2023-09-13 20:44:53.306772537 +0200
@@ -18,17 +18,18 @@
 
 %define cpan_name App-perlbrew
 Name:           perl-App-perlbrew
-Version:        0.97
+Version:        0.980.0
 Release:        0
+%define cpan_version 0.98
 License:        MIT
 Summary:        Manage perl installations in your $HOME
 URL:            https://metacpan.org/release/%{cpan_name}
-Source0:        
https://cpan.metacpan.org/authors/id/G/GU/GUGOD/%{cpan_name}-%{version}.tar.gz
+Source0:        
https://cpan.metacpan.org/authors/id/G/GU/GUGOD/%{cpan_name}-%{cpan_version}.tar.gz
 Source1:        cpanspec.yml
 BuildArch:      noarch
 BuildRequires:  perl
 BuildRequires:  perl-macros
-BuildRequires:  perl(CPAN::Perl::Releases) >= 5.20230423
+BuildRequires:  perl(CPAN::Perl::Releases) >= 5.20230720
 BuildRequires:  perl(Capture::Tiny) >= 0.48
 BuildRequires:  perl(Devel::PatchPerl) >= 2.08
 BuildRequires:  perl(ExtUtils::MakeMaker) >= 7.22
@@ -39,7 +40,7 @@
 BuildRequires:  perl(Module::Build::Tiny) >= 0.039
 BuildRequires:  perl(Path::Class) >= 0.33
 BuildRequires:  perl(Pod::Usage) >= 1.69
-BuildRequires:  perl(Test::Exception) >= 0.320000
+BuildRequires:  perl(Test::Exception) >= 0.32
 BuildRequires:  perl(Test::More) >= 1.001002
 BuildRequires:  perl(Test::NoWarnings) >= 1.04
 BuildRequires:  perl(Test::Output) >= 1.03
@@ -47,7 +48,7 @@
 BuildRequires:  perl(Test::Spec) >= 0.49
 BuildRequires:  perl(Test::TempDir::Tiny) >= 0.016
 BuildRequires:  perl(local::lib) >= 2.000014
-Requires:       perl(CPAN::Perl::Releases) >= 5.20230423
+Requires:       perl(CPAN::Perl::Releases) >= 5.20230720
 Requires:       perl(Capture::Tiny) >= 0.48
 Requires:       perl(Devel::PatchPerl) >= 2.08
 Requires:       perl(ExtUtils::MakeMaker) >= 7.22
@@ -55,6 +56,14 @@
 Requires:       perl(JSON::PP)
 Requires:       perl(Pod::Usage) >= 1.69
 Requires:       perl(local::lib) >= 2.000014
+Provides:       perl(App::Perlbrew::HTTP)
+Provides:       perl(App::Perlbrew::Path)
+Provides:       perl(App::Perlbrew::Path::Installation)
+Provides:       perl(App::Perlbrew::Path::Installations)
+Provides:       perl(App::Perlbrew::Path::Root)
+Provides:       perl(App::Perlbrew::Util)
+Provides:       perl(App::perlbrew) = 0.980.0
+%define         __perllib_provides /bin/true
 %{perl_requires}
 # MANUAL BEGIN
 BuildRequires:  wget curl groff
@@ -77,7 +86,7 @@
 read.
 
 %prep
-%autosetup  -n %{cpan_name}-%{version}
+%autosetup  -n %{cpan_name}-%{cpan_version}
 
 # MANUAL BEGIN
 chmod a+x t/fake-bin/curl

++++++ App-perlbrew-0.97.tar.gz -> App-perlbrew-0.98.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.97/Changes 
new/App-perlbrew-0.98/Changes
--- old/App-perlbrew-0.97/Changes       2023-05-12 16:24:50.000000000 +0200
+++ new/App-perlbrew-0.98/Changes       2023-08-11 16:19:46.000000000 +0200
@@ -1,3 +1,9 @@
+0.98
+       - Released at 2023-08-11T22:54:38+0900
+       - Remove the support of cperl from `available` and `install` command. 
Github PR: #777. cperl can still be installed by specifying the tarball, just 
not by their short names.
+       - new command: make-shim
+       - new command: make-pp.
+
 0.97
        - Released at 2023-05-12T22:33:42+0900
        - Thanks to our contributors: Elvin Aslanov, Graham Knop, Shoichi Kaji, 
Tomasz Konojacki, brian greenfield
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.97/MANIFEST 
new/App-perlbrew-0.98/MANIFEST
--- old/App-perlbrew-0.97/MANIFEST      2023-05-12 16:24:50.000000000 +0200
+++ new/App-perlbrew-0.98/MANIFEST      2023-08-11 16:19:46.000000000 +0200
@@ -39,8 +39,6 @@
 t/14.perl_version_parsing.t
 t/15.no-reuse-build-dir.t
 t/16.release-detail.t
-t/17.release-detail-cperl-local.t
-t/17.release-detail-cperl-remote.t
 t/18.release-detail-perl-local.t
 t/18.release-detail-perl-remote.t
 t/19.find_similar_commands.t
@@ -64,6 +62,7 @@
 t/command-install.t
 t/command-lib.t
 t/command-list.t
+t/command-make-shim.t
 t/current_perl.t
 t/current_shell.t
 t/do_system.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.97/META.json 
new/App-perlbrew-0.98/META.json
--- old/App-perlbrew-0.97/META.json     2023-05-12 16:24:50.000000000 +0200
+++ new/App-perlbrew-0.98/META.json     2023-08-11 16:19:46.000000000 +0200
@@ -27,7 +27,7 @@
       },
       "runtime" : {
          "requires" : {
-            "CPAN::Perl::Releases" : "5.20230423",
+            "CPAN::Perl::Releases" : "5.20230720",
             "Capture::Tiny" : "0.48",
             "Devel::PatchPerl" : "2.08",
             "ExtUtils::MakeMaker" : "7.22",
@@ -74,7 +74,7 @@
       },
       "App::perlbrew" : {
          "file" : "lib/App/perlbrew.pm",
-         "version" : "0.97"
+         "version" : "0.98"
       }
    },
    "release_status" : "stable",
@@ -88,8 +88,8 @@
          "web" : "https://github.com/gugod/App-perlbrew";
       }
    },
-   "version" : "0.97",
-   "x_serialization_backend" : "JSON::PP version 4.07",
+   "version" : "0.98",
+   "x_serialization_backend" : "JSON::PP version 4.16",
    "x_spdx_expression" : "MIT",
    "x_static_install" : "1"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.97/META.yml 
new/App-perlbrew-0.98/META.yml
--- old/App-perlbrew-0.97/META.yml      2023-05-12 16:24:50.000000000 +0200
+++ new/App-perlbrew-0.98/META.yml      2023-08-11 16:19:46.000000000 +0200
@@ -37,9 +37,9 @@
     file: lib/App/Perlbrew/Util.pm
   App::perlbrew:
     file: lib/App/perlbrew.pm
-    version: '0.97'
+    version: '0.98'
 requires:
-  CPAN::Perl::Releases: '5.20230423'
+  CPAN::Perl::Releases: '5.20230720'
   Capture::Tiny: '0.48'
   Devel::PatchPerl: '2.08'
   ExtUtils::MakeMaker: '7.22'
@@ -51,7 +51,7 @@
 resources:
   bugtracker: https://github.com/gugod/App-perlbrew/issues
   repository: https://github.com/gugod/App-perlbrew.git
-version: '0.97'
+version: '0.98'
 x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
 x_spdx_expression: MIT
 x_static_install: '1'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.97/cpanfile 
new/App-perlbrew-0.98/cpanfile
--- old/App-perlbrew-0.97/cpanfile      2023-05-12 16:24:50.000000000 +0200
+++ new/App-perlbrew-0.98/cpanfile      2023-08-11 16:19:46.000000000 +0200
@@ -1,5 +1,5 @@
 # Always requires the latest for this two.
-requires 'CPAN::Perl::Releases' => '5.20230423';
+requires 'CPAN::Perl::Releases' => '5.20230720';
 requires 'Devel::PatchPerl'     => '2.08';
 
 requires 'Capture::Tiny'        => '0.48';
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.97/lib/App/Perlbrew/HTTP.pm 
new/App-perlbrew-0.98/lib/App/Perlbrew/HTTP.pm
--- old/App-perlbrew-0.97/lib/App/Perlbrew/HTTP.pm      2023-05-12 
16:24:50.000000000 +0200
+++ new/App-perlbrew-0.98/lib/App/Perlbrew/HTTP.pm      2023-08-11 
16:19:46.000000000 +0200
@@ -68,7 +68,7 @@
     my $ua = http_user_agent_program;
     my $cmd = $commands{ $ua }->{ $purpose };
     for (keys %$params) {
-        $cmd =~ s!{$_}!$params->{$_}!g;
+        $cmd =~ s!{$_}!\Q$params->{$_}\E!g;
     }
 
     if ($HTTP_VERBOSE) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.97/lib/App/perlbrew.pm 
new/App-perlbrew-0.98/lib/App/perlbrew.pm
--- old/App-perlbrew-0.97/lib/App/perlbrew.pm   2023-05-12 16:24:50.000000000 
+0200
+++ new/App-perlbrew-0.98/lib/App/perlbrew.pm   2023-08-11 16:19:46.000000000 
+0200
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 use 5.008;
-our $VERSION = "0.97";
+our $VERSION = "0.98";
 use Config qw( %Config );
 
 BEGIN {
@@ -188,6 +188,7 @@
         'notest|n',
         'quiet|q',
         'verbose|v',
+        'output|o=s',
         'as=s',
         'append=s',
         'help|h',
@@ -647,7 +648,7 @@
     my @installed  = $self->installed_perls(@_);
     my $is_verbose = $self->{verbose};
 
-    my @sections = ( ['perl', 'available_perl_distributions'], ['cperl', 
'available_cperl_distributions'], );
+    my @sections = ( ['perl', 'available_perl_distributions'] );
 
     for (@sections) {
         my ( $header, $method ) = @$_;
@@ -690,7 +691,7 @@
 
 sub available_perls {
     my ($self) = @_;
-    my %dists = ( %{ $self->available_perl_distributions }, %{ 
$self->available_cperl_distributions }, );
+    my %dists = ( %{ $self->available_perl_distributions } );
     return $self->sort_perl_versions( keys %dists );
 }
 
@@ -705,11 +706,8 @@
     # and we do our own processing to filter out the development
     # releases and minor versions when needed (using
     # filter_perl_available)
-    my $url  = 'https://fastapi.metacpan.org/v1/release/versions/perl';
-    my $json = http_get( $url, undef, undef );
-    unless ($json) {
-        die "\nERROR: Unable to retrieve list of perls from Metacpan.\n\n";
-    }
+    my $json = 
http_get('https://fastapi.metacpan.org/v1/release/versions/perl')
+        or die "\nERROR: Unable to retrieve list of perls from Metacpan.\n\n";
 
     my $decoded = decode_json($json);
     for my $release ( @{ $decoded->{releases} } ) {
@@ -722,30 +720,6 @@
     return $perls;
 }
 
-# -> Map[ NameVersion =>  URL ]
-sub available_cperl_distributions {
-    my ($self) = @_;
-    my %dist;
-
-    # cperl releases: https://github.com/perl11/cperl/tags
-    my $cperl_remote           = 'https://github.com';
-    my $url_cperl_release_list = $cperl_remote . '/perl11/cperl/releases';
-
-    my $html = http_get($url_cperl_release_list);
-
-    unless ($html) {
-        die "\nERROR: Unable to retrieve the list of cperl releases from 
${url_cperl_release_list}\n";
-    }
-
-    if ($html) {
-        while ( $html =~ 
m{href="(/perl11/cperl/releases/download/cperl-(5.+?)/cperl-.+?\.tar\.gz)"}g ) {
-            $dist{"cperl-$2"} = $cperl_remote . $1;
-        }
-    }
-
-    return \%dist;
-}
-
 # $perllist is an arrayref of arrayrefs.  The inner arrayrefs are of the
 # format: [ <perl_name>, <perl_url> ]
 #   perl_name = something like perl-5.28.0
@@ -807,7 +781,7 @@
         }
     }
 
-    my $json = 
http_get("'https://fastapi.metacpan.org/v1/release/_search?size=1&q=name:perl-${version}'");
+    my $json = 
http_get("https://fastapi.metacpan.org/v1/release/_search?size=1&q=name:perl-${version}";);
 
     my $result;
     unless ( $json and $result = decode_json($json)->{hits}{hits}[0] ) {
@@ -822,24 +796,6 @@
     return ( $dist_tarball, $dist_tarball_url );
 }
 
-sub cperl_release {
-    my ( $self, $version ) = @_;
-    my %url = (
-        "5.22.3"     => 
"https://github.com/perl11/cperl/releases/download/cperl-5.22.3/cperl-5.22.3.tar.gz";,
-        "5.22.2"     => 
"https://github.com/perl11/cperl/releases/download/cperl-5.22.2/cperl-5.22.2.tar.gz";,
-        "5.24.0-RC1" => 
"https://github.com/perl11/cperl/releases/download/cperl-5.24.0-RC1/cperl-5.24.0-RC1.tar.gz";,
-    );
-
-    # my %digest => {
-    #     "5.22.3" => "bcf494a6b12643fa5e803f8e0d9cef26312b88fc",
-    #     "5.22.2" => "8615964b0a519cf70d69a155b497de98e6a500d0",
-    # };
-
-    my $dist_tarball_url = $url{$version} or die "ERROR: Cannot find the 
tarball for cperl-$version\n";
-    my $dist_tarball     = "cperl-${version}.tar.gz";
-    return ( $dist_tarball, $dist_tarball_url );
-}
-
 sub release_detail_perl_local {
     my ( $self, $dist, $rd ) = @_;
     $rd ||= {};
@@ -884,7 +840,7 @@
         }
     }
 
-    my $json = 
http_get("'https://fastapi.metacpan.org/v1/release/_search?size=1&q=name:perl-${version}'");
+    my $json = 
http_get("https://fastapi.metacpan.org/v1/release/_search?size=1&q=name:perl-${version}";);
 
     my $result;
     unless ( $json and $result = decode_json($json)->{hits}{hits}[0] ) {
@@ -904,56 +860,11 @@
     return ( $error, $rd );
 }
 
-sub release_detail_cperl_local {
-    my ( $self, $dist, $rd ) = @_;
-    $rd ||= {};
-    my %url = (
-        "cperl-5.22.3"     => 
"https://github.com/perl11/cperl/releases/download/cperl-5.22.3/cperl-5.22.3.tar.gz";,
-        "cperl-5.22.2"     => 
"https://github.com/perl11/cperl/releases/download/cperl-5.22.2/cperl-5.22.2.tar.gz";,
-        "cperl-5.24.0-RC1" =>
-            
"https://github.com/perl11/cperl/releases/download/cperl-5.24.0-RC1/cperl-5.24.0-RC1.tar.gz";,
-        "cperl-5.24.2" => 
"https://github.com/perl11/cperl/releases/download/cperl-5.24.2/cperl-5.24.2.tar.gz";,
-        "cperl-5.25.2" => 
"https://github.com/perl11/cperl/releases/download/cperl-5.24.2/cperl-5.25.2.tar.gz";,
-        "cperl-5.26.4" => 
"https://github.com/perl11/cperl/releases/download/cperl-5.26.4/cperl-5.26.4.tar.gz";,
-        "cperl-5.26.5" => 
"https://github.com/perl11/cperl/releases/download/cperl-5.26.5/cperl-5.26.5.tar.gz";,
-        "cperl-5.28.2" => 
"https://github.com/perl11/cperl/releases/download/cperl-5.28.2/cperl-5.28.2.tar.gz";,
-        "cperl-5.29.0" => 
"https://github.com/perl11/cperl/releases/download/cperl-5.29.0/cperl-5.29.0.tar.gz";,
-        "cperl-5.29.1" => 
"https://github.com/perl11/cperl/releases/download/cperl-5.29.1/cperl-5.29.1.tar.gz";,
-        "cperl-5.30.0" => 
"https://github.com/perl11/cperl/releases/download/cperl-5.30.0/cperl-5.30.0.tar.gz";,
-    );
-
-    my $error = 1;
-    if ( my $u = $url{$dist} ) {
-        $rd->{tarball_name} = "${dist}.tar.gz";
-        $rd->{tarball_url}  = $u;
-        $error              = 0;
-    }
-    return ( $error, $rd );
-}
-
-sub release_detail_cperl_remote {
-    my ( $self, $dist, $rd ) = @_;
-    $rd ||= {};
-
-    my $expect_href = "/perl11/cperl/releases/download/${dist}/${dist}.tar.gz";
-    my $error       = 1;
-
-    my $html = eval { http_get( 
'https://github.com/perl11/cperl/releases/tag/' . $dist ); } || "";
-
-    if ( $html =~ m{ <a \s+ href="($expect_href)" }xsi ) {
-        $rd->{tarball_name} = "${dist}.tar.gz";
-        $rd->{tarball_url}  = "https://github.com"; . $1;
-        $error              = 0;
-    }
-
-    return ( $error, $rd );
-}
-
 sub release_detail {
     my ( $self, $dist ) = @_;
     my ( $dist_type, $dist_version );
 
-    ( $dist_type, $dist_version ) = $dist =~ /^ (?: (c?perl) -? )? ( [\d._]+ 
(?:-RC\d+)? |git|stable|blead)$/x;
+    ( $dist_type, $dist_version ) = $dist =~ /^ (?: (perl) -? )? ( [\d._]+ 
(?:-RC\d+)? |git|stable|blead)$/x;
     $dist_type = "perl" if $dist_version && !$dist_type;
 
     my $rd = {
@@ -963,10 +874,14 @@
         tarball_name => undef,
     };
 
-# dynamic methods: release_detail_perl_local, release_detail_cperl_local, 
release_detail_perl_remote, release_detail_cperl_remote
+    # dynamic methods: release_detail_perl_local, release_detail_perl_remote
     my $m_local  = "release_detail_${dist_type}_local";
     my $m_remote = "release_detail_${dist_type}_remote";
 
+    unless ($self->can($m_local) && $self->can($m_remote)) {
+        die "ERROR: Unknown dist type: $dist_type\n";
+    }
+
     my ($error) = $self->$m_local( $dist, $rd );
     ($error) = $self->$m_remote( $dist, $rd ) if $error;
 
@@ -1728,7 +1643,8 @@
         }
     }
 
-    my $body = http_get($url) or die "\nERROR: Failed to retrieve 
$program_name executable.\n\n";
+    my $body = http_get($url)
+        or die "\nERROR: Failed to retrieve $program_name executable.\n\n";
 
     unless ( $body =~ m{\A#!/}s ) {
         my $x = App::Perlbrew::Path->new( $self->env('TMPDIR') || "/tmp", 
"${program_name}.downloaded.$$" );
@@ -2133,10 +2049,9 @@
         "To immediately make it effective, run this line in this terminal:\n\n 
   exec @{[ $self->env('SHELL') ]}\n\n";
 }
 
-sub run_command_env {
-    my ( $self, $name ) = @_;
-
-    my %env = $self->perlbrew_env($name);
+sub shell_env {
+    my ( $self, $env ) = @_;
+    my %env = %$env;
 
     my @statements;
     for my $k ( sort keys %env ) {
@@ -2150,15 +2065,17 @@
         }
     }
 
+    my $statements = "";
+
     if ( $self->env('SHELL') =~ /(ba|k|z|\/)sh\d?$/ ) {
         for (@statements) {
             my ( $o, $k, $v ) = @$_;
             if ( $o eq 'unset' ) {
-                print "unset $k\n";
+                $statements .= "unset $k\n";
             }
             else {
                 $v =~ s/(\\")/\\$1/g;
-                print "export $k=\"$v\"\n";
+                $statements .= "export $k=\"$v\"\n";
             }
         }
     }
@@ -2166,13 +2083,21 @@
         for (@statements) {
             my ( $o, $k, $v ) = @$_;
             if ( $o eq 'unset' ) {
-                print "unsetenv $k\n";
+                $statements .= "unsetenv $k\n";
             }
             else {
-                print "setenv $k \"$v\"\n";
+                $statements .= "setenv $k \"$v\"\n";
             }
         }
     }
+
+    return $statements;
+}
+
+sub run_command_env {
+    my ( $self, $name ) = @_;
+
+    print $self->shell_env({ $self->perlbrew_env($name) });
 }
 
 sub run_command_symlink_executables {
@@ -2800,6 +2725,117 @@
     print $self->format_info_output(@_);
 }
 
+sub run_command_make_shim {
+    my ($self, $program) = @_;
+
+    unless ($program) {
+        $self->run_command_help("make-shim");
+        return;
+    }
+
+    my $output = $self->{output} || $program;
+
+    if (-f $output) {
+        die "ERROR: $program already exists under current directory.\n";
+    }
+
+    my $current_env = $self->current_env
+        or die "ERROR: perlbrew is not activated. make-shim requires an 
perlbrew environment to be activated.\nRead the usage by running: perlbrew help 
make-shim\n";
+
+    my %env = $self->perlbrew_env( $current_env );
+
+    my $shebang = '#!' . $self->env('SHELL');
+    my $preemble = $self->shell_env(\%env);
+    my $path = $self->shell_env({ PATH => $env{"PERLBREW_PATH"} . ":" . 
$self->env("PATH") });
+    my $shim = join(
+        "\n",
+        $shebang,
+        $preemble,
+        $path,
+        'exec ' . $program . ' "$@"',
+        "\n"
+    );
+
+    open my $fh, ">", "$output" or die $!;
+    print $fh $shim;
+    close $fh;
+    chmod 0755, $output;
+
+    if ( $self->{verbose} ) {
+        print "The shim $output is made.\n";
+    }
+}
+
+sub run_command_make_pp {
+    my ($self, $program) = @_;
+
+    unless ($program) {
+        $self->run_command_help("make-pp");
+        return;
+    }
+
+    my $current_env = $self->current_env
+        or die "ERROR: perlbrew is not activated. make-pp requires an perlbrew 
environment to be activated.\nRead the usage by running: perlbrew help 
make-pp\n";
+
+    my $output = $self->{output} || $program;
+
+    if (-f $output) {
+        die "ERROR: $program already exists under current directory.\n";
+    }
+
+    my $path_program = $self->whereis_in_env($program, $current_env)
+        or die "ERROR: $program cannot be found in $current_env";
+    my $path_pp = $self->whereis_in_env("pp", $current_env)
+            or die "ERROR: pp cannot be found in $current_env";
+
+
+    my $sitelib = $self->do_capture(
+        $self->installed_perl_executable( $self->current_perl ),
+        "-MConfig",
+        "-e",
+        'print $Config{sitelibexp}',
+    );
+
+    my $locallib;
+    if ($self->current_lib) {
+        require local::lib;
+        my ($current_lib) = grep { $_->{is_current} } $self->local_libs();
+        my @llpaths = sort { length($a) <=> length($b) }
+            local::lib->lib_paths_for( $current_lib->{dir} );
+        $locallib = $llpaths[0];
+    }
+
+    my $perlversion = $self->do_capture(
+        $self->installed_perl_executable( $self->current_perl ),
+        "-MConfig",
+        "-e",
+        'print $Config{version}',
+    );
+
+    my @cmd = (
+        $path_pp,
+        "-B", # core modules
+        "-a", "$sitelib;$perlversion",
+        ($locallib ? ("-a", "$locallib;$perlversion") : ()),
+        "-z", "9",
+        "-o", $output,
+        $path_program,
+    );
+
+    $self->do_system(@cmd);
+}
+
+sub whereis_in_env {
+    my ($self, $program, $env) = @_;
+    my %env = $self->perlbrew_env( $env );
+    my @paths = split /:/, $env{PERLBREW_PATH};
+
+    my ($path) = grep { -x $_ } map { App::Perlbrew::Path->new($_, $program) } 
@paths;
+
+    return $path;
+}
+
+
 sub BASHRC_CONTENT() {
     return
           "export PERLBREW_SHELLRC_VERSION=$VERSION\n"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.97/script/perlbrew 
new/App-perlbrew-0.98/script/perlbrew
--- old/App-perlbrew-0.97/script/perlbrew       2023-05-12 16:24:50.000000000 
+0200
+++ new/App-perlbrew-0.98/script/perlbrew       2023-08-11 16:19:46.000000000 
+0200
@@ -186,8 +186,6 @@
 
 =item blead
 
-=item cperl-<version>
-
 =back
 
 Version numbers usually look like "5.x.xx", or "perl-5.xx.x-RCx" for
@@ -208,13 +206,6 @@
 Version number alone without the "perl-" prefix means the official
 release provided by perl5 porters.
 
-The prefix "cperl" is a special release provided not by perl5 porters,
-but from the community. The cperl distributions are downloaded from:
-
-    https://github.com/perl11/cperl/releases
-
-See https://perl11.org/cperl/ for more information about cperl distribution.
-
 Options for C<install> command:
 
     -f --force     Force installation
@@ -660,6 +651,64 @@
 
 Note that this does not guarantee that the versions of modules stay the same 
in the destination.
 
+=head1 COMMAND: MAKE-SHIM
+
+Usage:
+
+    perlbrew make-shim <program>
+    perlbrew make-shim -o <shim-name> <program>
+    perlbrew make-shim --output <shim-name> <program>
+
+This commands produce an executable file under current directory named 
C<program>, or C<shim-name> if given after C<--output> (or C<-o> for short). 
The output is a shell-wrapper, a shim, of the named program inside current 
perlbrew environment.
+
+When the shim is executed, the original C<program> is then executed with all 
relevant environment variable set to the perlbrew environment it is installed 
in, regardless which perlbrew environment is currently activated. The shim can 
also be moved to different directories and, such as the conventional 
C<~/.local/bin>, so it is always available.
+
+For example, you may find C<tldr> from L<App::tldr> a handy tool and decide to 
install it inside your daily working environment:
+
+    perlbrew use perl-5.36.1
+    cpm install -g App::tldr
+
+But when you occasionally have to switch to a different environment, C<PATH> 
would be tweaked and the command C<tldr> would went missing, and that is the 
expected outcome:
+
+    perlbrew use perl-5.18.4
+    tldr perl  #=> error: command not found
+
+It would be nice if C<tldr> can be made universally available. One way to 
mitigate such needs is to prepare install the C<tldr> program outside of 
C<PERLBREW_ROOT>, while still utilize perlbrew environment to run it.
+
+For example, prepare a conventional directory C<~/.local/bin> and put that in 
C<PATH>, then:
+
+    perlbrew use perl-5.36.1
+
+    cd /tmp
+    perlbrew make-shim tldr
+    mv /tmp/tldr ~/.local/bin/tldr
+
+This C<~/.local/bin/tldr> is a shell-wrapper of the actual C<tldr> program, 
and it internally activates the perlbrew environment C<perl-5.36.1>. Running 
the tldr shim will then always run the actual C<tldr>, no matter which perlbrew 
environment is activated, or even if perlbrew is turned off. The only 
requirements is that the perlbrew environment C<perl-5.36.1> and the 
installation of C<App::tldr> has to remain.
+
+=head1 COMMAND: MAKE-PP
+
+Usage:
+
+    perlbrew make-pp <program>
+    perlbrew make-pp -o <name> <program>
+    perlbrew make-pp --output <name> <program>
+
+This commands produce an executable file under current directory named 
C<program>, or C<name> if given after C<--output> (or C<-o> for short). The 
output is a PAR-packed version of the named program inside current perlbrew 
environment.
+
+This requires the current perlbrew environment to have L<PAR> and 
L<PAR::Packer> installed first. Otherwise C<make-pp> bails out. In addition, if 
current perl is not a perlbrew-managed perl, <make-pp> also bails out.
+
+The produced file is a standalone binary executable containing these content:
+
+    1. The named program
+    2. perl runtime
+    3. all core perl libs of current perl
+    4. the entire site lib
+    5. the entire local lib (managed by `perlbrew lib` command), if active.
+
+It is expected that the executable can then be running on a different machine 
of the same OS and arch.
+
+Noted that this approach is the maximum overkill for packing one program as 
it'll be definitely packaing a lot more then the exact list of runtime 
dependencies of the named program. C<make-pp> is meant for a lazy solution for 
a non-trivial problem of perfectly determing the runtime dependencies of an 
arbitarary program.
+
 =head1 SEE ALSO
 
 L<App::perlbrew>, L<App::cpanminus>, L<Devel::PatchPerl>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.97/t/08.error_available.t 
new/App-perlbrew-0.98/t/08.error_available.t
--- old/App-perlbrew-0.97/t/08.error_available.t        2023-05-12 
16:24:50.000000000 +0200
+++ new/App-perlbrew-0.98/t/08.error_available.t        2023-08-11 
16:19:46.000000000 +0200
@@ -25,13 +25,4 @@
     qr[ERROR:]
 );
 
-throws_ok(
-    sub {
-        my $app = App::perlbrew->new("available");
-        my $ret = $app->available_cperl_distributions();
-    },
-    qr[ERROR:]
-);
-
-
 done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.97/t/16.release-detail.t 
new/App-perlbrew-0.98/t/16.release-detail.t
--- old/App-perlbrew-0.97/t/16.release-detail.t 2023-05-12 16:24:50.000000000 
+0200
+++ new/App-perlbrew-0.98/t/16.release-detail.t 2023-08-11 16:19:46.000000000 
+0200
@@ -36,18 +36,4 @@
     is $rd->{version}, "5.18.2";
 };
 
-subtest 'parse "cperl-5.22.2"' => sub {
-    my $app = App::perlbrew->new();
-
-    my $rd = $app->release_detail("cperl-5.22.2");
-
-    ok defined( $rd->{type} );
-    ok defined( $rd->{version} );
-    ok defined( $rd->{tarball_url} );
-    ok defined( $rd->{tarball_name} );
-
-    is $rd->{type}, "cperl";
-    is $rd->{version}, "5.22.2";
-};
-
 done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.97/t/17.release-detail-cperl-local.t 
new/App-perlbrew-0.98/t/17.release-detail-cperl-local.t
--- old/App-perlbrew-0.97/t/17.release-detail-cperl-local.t     2023-05-12 
16:24:50.000000000 +0200
+++ new/App-perlbrew-0.98/t/17.release-detail-cperl-local.t     1970-01-01 
01:00:00.000000000 +0100
@@ -1,22 +0,0 @@
-#!perl
-use strict;
-use App::perlbrew;
-use File::Temp qw( tempdir );
-$App::perlbrew::PERLBREW_ROOT = tempdir( CLEANUP => 1 );
-$App::perlbrew::PERLBREW_HOME = tempdir( CLEANUP => 1 );
-$ENV{PERLBREW_ROOT} = $App::perlbrew::PERLBREW_ROOT;
-
-use Test::More;
-
-my $app = App::perlbrew->new();
-
-my $rd = { type => "cperl", "version" => "5.22.2" };
-$app->release_detail_cperl_local("cperl-5.22.2", $rd);
-
-ok defined( $rd->{tarball_url} );
-ok defined( $rd->{tarball_name} );
-
-is $rd->{tarball_url}, 
"https://github.com/perl11/cperl/releases/download/cperl-5.22.2/cperl-5.22.2.tar.gz";;
-is $rd->{tarball_name}, "cperl-5.22.2.tar.gz";
-
-done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.97/t/17.release-detail-cperl-remote.t 
new/App-perlbrew-0.98/t/17.release-detail-cperl-remote.t
--- old/App-perlbrew-0.97/t/17.release-detail-cperl-remote.t    2023-05-12 
16:24:50.000000000 +0200
+++ new/App-perlbrew-0.98/t/17.release-detail-cperl-remote.t    1970-01-01 
01:00:00.000000000 +0100
@@ -1,36 +0,0 @@
-#!perl
-use strict;
-use App::perlbrew;
-use File::Temp qw( tempdir );
-$App::perlbrew::PERLBREW_ROOT = tempdir( CLEANUP => 1 );
-$App::perlbrew::PERLBREW_HOME = tempdir( CLEANUP => 1 );
-$ENV{PERLBREW_ROOT} = $App::perlbrew::PERLBREW_ROOT;
-
-use Test::More;
-
-unless ($ENV{TEST_LIVE}) {
-    plan skip_all => 'These tests send HTTP requests. Set env TEST_LIVE=1 to 
really run them.';
-}
-
-my $app = App::perlbrew->new();
-
-subtest 'Unknown version, expecting error', sub {
-    my ($error, $rd) = $app->release_detail_cperl_remote("xxx");
-    ok $error, "Errored, as expected";
-    ok defined($rd);
-};
-
-for my $version ("5.27.1", "5.30.0") {
-    subtest "Known version ($version), expecting success", sub {
-        my $rd = { type => "cperl", "version" => $version };
-        $app->release_detail_cperl_remote("cperl-${version}", $rd);
-
-        ok defined( $rd->{tarball_url} );
-        ok defined( $rd->{tarball_name} );
-
-        is $rd->{tarball_url}, 
"https://github.com/perl11/cperl/releases/download/cperl-${version}/cperl-${version}.tar.gz";;
-        is $rd->{tarball_name}, "cperl-${version}.tar.gz";
-    }
-}
-
-done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.97/t/command-available.t 
new/App-perlbrew-0.98/t/command-available.t
--- old/App-perlbrew-0.97/t/command-available.t 2023-05-12 16:24:50.000000000 
+0200
+++ new/App-perlbrew-0.98/t/command-available.t 2023-08-11 16:19:46.000000000 
+0200
@@ -26,15 +26,9 @@
     'perl5.004_05' => 'http://www.cpan.org/src/5.0/perl5.004_05.tar.gz',
 );
 
-my %available_cperl_dists = (
-    'cperl-5.26.1' => 
'https://github.com/perl11/cperl/archive/cperl-5.26.1.tar.gz',
-    'cperl-5.27.1' => 
'https://github.com/perl11/cperl/archive/cperl-5.27.1.tar.gz',
-);
-
 sub mocked_perlbrew {
     my $app = App::perlbrew->new( @_ );
     $app->expects( 'available_perl_distributions' )->returns( 
\%available_perl_dists );
-    $app->expects( 'available_cperl_distributions' )->returns( 
\%available_cperl_dists );
     return $app;
 }
 
@@ -82,7 +76,7 @@
               (
                   \# .+ \n
                   (
-                      \s{3,}c?perl-?\d\.\d{1,3}[_.]\d{1,2}
+                      \s{3,}perl-?\d\.\d{1,3}[_.]\d{1,2}
                       \s+
                       (
                           INSTALLED \s on \s .+ \s via
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.97/t/command-make-shim.t 
new/App-perlbrew-0.98/t/command-make-shim.t
--- old/App-perlbrew-0.97/t/command-make-shim.t 1970-01-01 01:00:00.000000000 
+0100
+++ new/App-perlbrew-0.98/t/command-make-shim.t 2023-08-11 16:19:46.000000000 
+0200
@@ -0,0 +1,87 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::Spec;
+use Test::Exception;
+use File::Temp qw( tempdir );
+
+use FindBin;
+use lib $FindBin::Bin;
+
+use App::perlbrew;
+require "test_helpers.pl";
+
+mock_perlbrew_install("perl-5.36.1");
+
+describe "App::perlbrew->make_shim()" => sub {
+    it "should show usage", sub {
+        mock_perlbrew_use("perl-5.36.1");
+
+        lives_ok {
+            my $app = App::perlbrew->new("make-shim");
+            $app->expects("run_command_help")->returns("")->at_least_once;
+            $app->run;
+        };
+    };
+};
+
+describe "App::perlbrew->make_shim('foo')" => sub {
+    it "should err when perlbrew is off" => sub {
+        mock_perlbrew_off();
+
+        my $dir = tempdir();
+        chdir($dir);
+
+        throws_ok {
+            my $app = App::perlbrew->new("make-shim", "foo");
+            $app->run();
+        } qr(^ERROR:);
+
+        ok ! -f "foo", "foo is not produced";
+    };
+
+    it "should err when 'foo' already exists" => sub {
+        mock_perlbrew_use("perl-5.36.1");
+        my $dir = tempdir();
+        chdir($dir);
+        io("foo")->print("hello");
+
+        throws_ok {
+            my $app = App::perlbrew->new("make-shim", "foo");
+            $app->run();
+        } qr(^ERROR:);
+
+        throws_ok {
+            my $app = App::perlbrew->new("make-shim", "-o", "foo", "bar");
+           $app->run();
+        } qr(^ERROR:);
+    };
+
+    it "should produce 'foo' in the current dir" => sub {
+        mock_perlbrew_use("perl-5.36.1");
+        my $dir = tempdir();
+        chdir($dir);
+
+        my $app = App::perlbrew->new("make-shim", "foo");
+        $app->run();
+
+        ok -f "foo", "foo is produced under current directory.";
+        my $shim_content = io("foo")->slurp;
+        diag "\nThe content of shim:\n----\n$shim_content\n----\n";
+    };
+
+    it "should produce 'foo' in the current dir" => sub {
+        mock_perlbrew_use("perl-5.36.1");
+        my $dir = tempdir();
+        chdir($dir);
+
+        my $app = App::perlbrew->new("make-shim", "-o", "foo", "bar");
+        $app->run();
+
+        ok -f "foo", "foo is produced under current directory.";
+        my $shim_content = io("foo")->slurp;
+        diag "\nThe content of shim:\n----\n$shim_content\n----\n";
+    };
+};
+
+runtests unless caller;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.97/t/test_helpers.pl 
new/App-perlbrew-0.98/t/test_helpers.pl
--- old/App-perlbrew-0.97/t/test_helpers.pl     2023-05-12 16:24:50.000000000 
+0200
+++ new/App-perlbrew-0.98/t/test_helpers.pl     2023-08-11 16:19:46.000000000 
+0200
@@ -30,7 +30,12 @@
 $App::perlbrew::PERLBREW_ROOT = tempdir( CLEANUP => 1 );
 $App::perlbrew::PERLBREW_HOME = tempdir( CLEANUP => 1 );
 $ENV{PERLBREW_ROOT} = $App::perlbrew::PERLBREW_ROOT;
+
 delete $ENV{PERLBREW_LIB};
+delete $ENV{PERLBREW_PERL};
+delete $ENV{PERLBREW_PATH};
+delete $ENV{PERLBREW_MANPATH};
+delete $ENV{PERL_LOCAL_LIB_ROOT};
 
 my $root = App::Perlbrew::Path::Root->new ($ENV{PERLBREW_ROOT});
 $root->perls->mkpath;
@@ -72,6 +77,24 @@
     App::perlbrew->new(install => $name, @args)->run();
 }
 
+sub mock_perlbrew_off {
+    mock_perlbrew_use("");
+}
+
+sub mock_perlbrew_use {
+    my ($name) = @_;
+
+    my %env = App::perlbrew->new()->perlbrew_env($name);
+
+    for my $k (qw< PERLBREW_PERL PERLBREW_LIB PERLBREW_PATH PERL5LIB >) {
+        if (defined $env{$k}) {
+            $ENV{$k} = $env{$k};
+        } else {
+            delete $ENV{$k}
+        }
+    }
+}
+
 sub mock_perlbrew_lib_create {
     my $name = shift;
     App::Perlbrew::Path->new($App::perlbrew::PERLBREW_HOME, "libs", 
$name)->mkpath;

Reply via email to