Honor scalar context for sort returned from a subroutine
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 25/100
Piste de recherche
Start by reviewing PR #1992, which is already open and describes the fix across the JVM and interpreter backends. Trace how a subroutine return passes runtime context to sort, then run the focused regression and scalar-sort tests on both backends. Done means scalar callers receive Perl's undef result while list behavior remains covered.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Summary
sort in a subroutine return did not honor the caller's scalar context. Perl returns undef for sort in scalar context, but PerlOnJava returned the number of sorted values. This broke DataCube 0.01's tables method, which returns sort keys ... and is called in scalar context by its test suite.
Minimal reproducer
sub f { return sort qw(a b c) }
my $x = f();
print defined($x) ? "<$x>\n" : "undef\n";
Expected under system Perl: undef
Before the fix, PerlOnJava returned <3> on both JVM and interpreter backends.
Evidence
- CPAN distribution: DataCube 0.01; random tester run
20261106-154847-45334. - System Perl 5.42.2: upstream
make testpassed, 26 tests. - PerlOnJava 5.44.1, build commit
13db7bd4a0:t/00_use.texited 255 on both JVM and interpreter after 15 assertions, withCan't use string ("40") as a HASH ref. - The DataCube test assigns
$cube->tablesto a scalar.DataCube::tablesreturnssort keys ...; the scalar result was then treated as a hash reference.
Confirmed cause and fix
Static scalar-context sort was already handled. In a subroutine return, however, the caller's context is dynamic: PerlOnJava retained the sorted list and generic return handling scalarized it to the list length. PR #1992 passes the runtime context to sort on both backends, preserving input evaluation while skipping the comparator and returning undef for a scalar caller.
The focused regression and existing scalar-sort tests pass on system Perl, JVM, and interpreter. The full repository make and documentation link check pass. The DataCube suite progresses beyond the former failure, but later tests exceed the bounded 180-second runs; a full post-fix DataCube suite pass is not claimed.
- Langage dominant
- Perl
- Étoiles
- 65
- Forks
- 8
- Merge moyen
- 5 h 57 min
- PR mergées (30 j)
- 177
Préparer son environnement
- Fournit un Dockerfile ou un fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de fglock/PerlOnJava
-
area:runtime documentation enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
fglock/PerlOnJava#1579 ·
Les mainteneurs répondent en général sous 1 jour
-
area:cpan-port area:parser bug
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
fglock/PerlOnJava#1990 ·
Les mainteneurs répondent en général sous 1 jour
-
area:parser area:unicode bug
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
fglock/PerlOnJava#1989 ·
Les mainteneurs répondent en général sous 1 jour
-
area:backend bug
Difficulté 4/5 3-5 jours Accessibilité débutants 55/100
fglock/PerlOnJava#1981 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
area:runtime bug
Difficulté 4/5 3-5 jours Accessibilité débutants 57/100
fglock/PerlOnJava#1980 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de fglock/PerlOnJava
Issues similaires
-
check_keywords.pl dies before reporting an unknown keyword categoryPeut-être pris @zhaohai666 l’a pris il y a 1 jour. Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 87/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
libwww-perl/HTTP-Message#236 ·
-
1.severity: security
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 1 jour
-
wave-followup
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100