Skip to content

Commit dbdd572

Browse files
committed
fix prototype in Carp module
1 parent 063692f commit dbdd572

File tree

1 file changed

+6
-12
lines changed
  • src/main/java/org/perlonjava/perlmodule

1 file changed

+6
-12
lines changed

src/main/java/org/perlonjava/perlmodule/Carp.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ public static void initialize() {
1717
carp.defineExport("EXPORT", "carp", "croak", "confess");
1818
carp.defineExport("EXPORT_OK", "cluck", "longmess", "shortmess");
1919
try {
20-
carp.registerMethod("carp", "$");
21-
carp.registerMethod("croak", "$");
22-
carp.registerMethod("confess", "$");
23-
carp.registerMethod("cluck", "$");
24-
carp.registerMethod("longmess", "$");
25-
carp.registerMethod("shortmess", "$");
20+
carp.registerMethod("carp", null);
21+
carp.registerMethod("croak", null);
22+
carp.registerMethod("confess", null);
23+
carp.registerMethod("cluck", null);
24+
carp.registerMethod("longmess", null);
25+
carp.registerMethod("shortmess", null);
2626
} catch (NoSuchMethodException e) {
2727
System.err.println("Warning: Missing Carp method: " + e.getMessage());
2828
}
@@ -53,9 +53,6 @@ public static RuntimeList shortmess(RuntimeArray args, int ctx) {
5353
}
5454

5555
private static RuntimeList warnOrDie(RuntimeArray args, int ctx, boolean die, boolean backtrace) {
56-
if (args.size() != 1) {
57-
throw new IllegalStateException("Bad number of arguments for Carp method");
58-
}
5956
RuntimeScalar message = args.get(0);
6057
String formattedMessage = message.toString();
6158

@@ -81,9 +78,6 @@ private static RuntimeList warnOrDie(RuntimeArray args, int ctx, boolean die, bo
8178
}
8279

8380
private static RuntimeList formatMessage(RuntimeArray args, int ctx, boolean longFormat) {
84-
if (args.size() != 1) {
85-
throw new IllegalStateException("Bad number of arguments for Carp method");
86-
}
8781
RuntimeScalar message = args.get(0);
8882
String formattedMessage = longFormat
8983
? ErrorMessageUtil.stringifyException(new Throwable(message.toString()))

0 commit comments

Comments
 (0)