@@ -7983,6 +7983,9 @@ PP(pp_multiparam)
79837983 SvPADSTALE_on (PAD_SVl (named -> padix ));
79847984 }
79857985
7986+ size_t n_errors = 0 ;
7987+ SV * error_names = NULL ;
7988+
79867989 while (argc ) {
79877990 SV * * svp ;
79887991
@@ -8060,22 +8063,48 @@ PP(pp_multiparam)
80608063 hv_store_ent (hv , name , newSVsv (val ), 0 );
80618064 }
80628065 else {
8063- // TODO: Consider collecting up all the names of unrecognised
8064- // in one string
8065- croak_caller ("Unrecognized named parameter '%" UTF8f "' to subroutine '%" SVf "'" ,
8066- UTF8fARG (true, namelen , namepv ), S_find_runcv_name ());
8066+ n_errors ++ ;
8067+ if (!error_names )
8068+ error_names = sv_2mortal (newSVpvs ("" ));
8069+ if (n_errors <= 5 ) {
8070+ /* Only bother collecting up the first 5 */
8071+ if (n_errors > 1 )
8072+ sv_catpvs (error_names , ", " );
8073+ sv_catpvf (error_names , "'%" UTF8f "'" , UTF8fARG (true, namelen , namepv ));
8074+ }
80678075 }
80688076 }
80698077
8078+ if (n_errors ) {
8079+ if (n_errors > 5 )
8080+ sv_catpvs (error_names , ", ..." );
8081+ /* diag_listed_as: Unrecognized named parameter '%s' to subroutine '%s' */
8082+ croak_caller ("Unrecognized named parameter%s %" SVf " to subroutine '%" SVf "'" ,
8083+ n_errors > 1 ? "s" : "" , SVfARG (error_names ), SVfARG (S_find_runcv_name ()));
8084+ }
8085+
80708086 for (size_t namedix = 0 ; namedix < n_named ; namedix ++ ) {
80718087 struct op_multiparam_named_aux * named = aux -> named + namedix ;
80728088 if (!named -> is_required || !SvPADSTALE (PAD_SVl (named -> padix )))
80738089 continue ;
80748090
8075- // TODO: Consider collecting up all the names of missing
8076- // parameters in one string
8077- croak_caller ("Missing required named parameter '%" UTF8f "' to subroutine '%" SVf "'" ,
8078- UTF8fARG (true, named -> namelen , named -> namepv ), S_find_runcv_name ());
8091+ n_errors ++ ;
8092+ if (!error_names )
8093+ error_names = sv_2mortal (newSVpvs ("" ));
8094+ if (n_errors <= 5 ) {
8095+ /* Only bother collecting up the first 5 */
8096+ if (n_errors > 1 )
8097+ sv_catpvs (error_names , ", " );
8098+ sv_catpvf (error_names , "'%" UTF8f "'" , UTF8fARG (true, named -> namelen , named -> namepv ));
8099+ }
8100+ }
8101+
8102+ if (n_errors ) {
8103+ if (n_errors > 5 )
8104+ sv_catpvs (error_names , ", ..." );
8105+ /* diag_listed_as: Missing required named parameter '%s' to subroutine '%s' */
8106+ croak_caller ("Missing required named parameter%s %" SVf " to subroutine '%" SVf "'" ,
8107+ n_errors > 1 ? "s" : "" , SVfARG (error_names ), SVfARG (S_find_runcv_name ()));
80798108 }
80808109 }
80818110
0 commit comments