Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/org/perlonjava/core/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public final class Configuration {
* Automatically populated by Gradle/Maven during build.
* DO NOT EDIT MANUALLY - this value is replaced at build time.
*/
public static final String gitCommitId = "38f2feac1";
public static final String gitCommitId = "5ab2ed282";

/**
* Git commit date of the build (ISO format: YYYY-MM-DD).
Expand All @@ -48,7 +48,7 @@ public final class Configuration {
* Parsed by App::perlbrew and other tools via: perl -V | grep "Compiled at"
* DO NOT EDIT MANUALLY - this value is replaced at build time.
*/
public static final String buildTimestamp = "Apr 21 2026 14:44:58";
public static final String buildTimestamp = "Apr 21 2026 16:09:03";

// Prevent instantiation
private Configuration() {
Expand Down
25 changes: 24 additions & 1 deletion src/main/java/org/perlonjava/runtime/operators/IOOperator.java
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,26 @@ public static RuntimeScalar seek(RuntimeScalar fileHandle, RuntimeList runtimeLi
}
}

/**
* sysseek returns the new file position, or undef on failure.
* A position of zero is returned as the string "0 but true".
*/
public static RuntimeScalar sysseek(RuntimeScalar fileHandle, RuntimeList runtimeList) {
RuntimeScalar seekResult = seek(fileHandle, runtimeList);
if (!seekResult.getBoolean()) {
return seekResult;
}
RuntimeScalar pos = tell(fileHandle);
long p = pos.getLong();
if (p < 0) {
return RuntimeIO.handleIOError("sysseek: could not determine position");
}
if (p == 0) {
return new RuntimeScalar("0 but true");
}
return pos;
}

public static RuntimeScalar getc(int ctx, RuntimeBase... args) {
RuntimeScalar fileHandle;
if (args.length < 1) {
Expand Down Expand Up @@ -3039,7 +3059,10 @@ public static RuntimeScalar readline(int ctx, RuntimeBase... args) {
}

public static RuntimeScalar sysseek(int ctx, RuntimeBase... args) {
return seek(ctx, args);
if (args.length < 3) throw new PerlCompilerException("Not enough arguments for sysseek");
RuntimeList list = new RuntimeList();
for (int i = 1; i < args.length; i++) list.add(args[i]);
return sysseek(args[0].scalar(), list);
}

public static RuntimeScalar read(int ctx, RuntimeBase... args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public record OperatorHandler(String className, String methodName, int methodTyp
put("getc", "getc", "org/perlonjava/runtime/operators/IOOperator", "(Lorg/perlonjava/runtime/runtimetypes/RuntimeScalar;)Lorg/perlonjava/runtime/runtimetypes/RuntimeScalar;");
put("binmode", "binmode", "org/perlonjava/runtime/operators/IOOperator", "(Lorg/perlonjava/runtime/runtimetypes/RuntimeScalar;Lorg/perlonjava/runtime/runtimetypes/RuntimeList;)Lorg/perlonjava/runtime/runtimetypes/RuntimeScalar;");
put("seek", "seek", "org/perlonjava/runtime/operators/IOOperator", "(Lorg/perlonjava/runtime/runtimetypes/RuntimeScalar;Lorg/perlonjava/runtime/runtimetypes/RuntimeList;)Lorg/perlonjava/runtime/runtimetypes/RuntimeScalar;");
put("sysseek", "seek", "org/perlonjava/runtime/operators/IOOperator", "(Lorg/perlonjava/runtime/runtimetypes/RuntimeScalar;Lorg/perlonjava/runtime/runtimetypes/RuntimeList;)Lorg/perlonjava/runtime/runtimetypes/RuntimeScalar;");
put("sysseek", "sysseek", "org/perlonjava/runtime/operators/IOOperator", "(Lorg/perlonjava/runtime/runtimetypes/RuntimeScalar;Lorg/perlonjava/runtime/runtimetypes/RuntimeList;)Lorg/perlonjava/runtime/runtimetypes/RuntimeScalar;");
put("select", "select", "org/perlonjava/runtime/operators/IOOperator", "(Lorg/perlonjava/runtime/runtimetypes/RuntimeList;I)Lorg/perlonjava/runtime/runtimetypes/RuntimeScalar;");
put("truncate", "truncate", "org/perlonjava/runtime/operators/IOOperator", "(I[Lorg/perlonjava/runtime/runtimetypes/RuntimeBase;)Lorg/perlonjava/runtime/runtimetypes/RuntimeScalar;");
put("flock", "flock", "org/perlonjava/runtime/operators/IOOperator", "(I[Lorg/perlonjava/runtime/runtimetypes/RuntimeBase;)Lorg/perlonjava/runtime/runtimetypes/RuntimeScalar;");
Expand Down
Loading