stevieb9 / berrybrew

Perlbrew for Windows!
Other
63 stars 9 forks source link

Associate sets handler incorrectly #303

Closed cmfrolick closed 2 years ago

cmfrolick commented 2 years ago

When the berrybrew associate set command is run, the handler sets to: perl.PerlPath + "\\perl.exe \"%1\" \"%*\""

Which looks like: berrybrewPerl=C:\berrybrew\5.30.3_64\perl\bin\perl.exe "%1" "%*"

The problem is, quoting the %* causes it to treat all arguments passed as one. If no arguments are passed, @ARGV contains an empty string, instead of being empty. This breaks Perl utility scripts used from the command line.

It should be: perl.PerlPath + "\\perl.exe \"%1\" %*" to get: berrybrewPerl=C:\berrybrew\5.30.3_64\perl\bin\perl.exe "%1" %*

Example

Test Script:

use strict;
use warnings;

use Data::Dumper;
$Data::Dumper::Varname = 'arguments';
print Dumper \@ARGV;

Output with current handler:

C:\Perl64>test.pl
$arguments1 = [
                ''
              ];

C:\Perl64>test.pl foo bar baz
$arguments1 = [
                ' foo bar baz'
              ];

After changing the handler:

C:\Perl64>ftype berrybrewPerl=C:\berrybrew\5.30.3_64\perl\bin\perl.exe "%1" %*
berrybrewPerl=C:\berrybrew\5.30.3_64\perl\bin\perl.exe "%1" %*

C:\Perl64>test.pl
$arguments1 = [];

C:\Perl64>test.pl foo bar baz
$arguments1 = [
                'foo',
                'bar',
                'baz'
              ];
stevieb9 commented 2 years ago

I have this fixed in the 1.35 branch. It'll be released within a few days.