File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
src/main/java/org/perlonjava/perlmodule Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 9
9
import java .util .*;
10
10
11
11
import static org .perlonjava .runtime .RuntimeScalarCache .*;
12
+ import static org .perlonjava .runtime .RuntimeScalarType .JAVAOBJECT ;
12
13
13
14
/**
14
15
* Text::CSV module implementation for PerlOnJava.
@@ -405,6 +406,11 @@ public static RuntimeList error_diag(RuntimeArray args, int ctx) {
405
406
private static CSVFormat buildCSVFormat (RuntimeHash self ) {
406
407
CSVFormat .Builder builder = CSVFormat .DEFAULT .builder ();
407
408
409
+ RuntimeScalar cached = self .get ("_CSVFormat" );
410
+ if (cached .type == JAVAOBJECT ) {
411
+ return (CSVFormat ) cached .value ;
412
+ }
413
+
408
414
// builder.setSkipHeaderRecord(false);
409
415
// builder.setAllowMissingColumnNames(true);
410
416
@@ -447,7 +453,9 @@ private static CSVFormat buildCSVFormat(RuntimeHash self) {
447
453
builder .setRecordSeparator ("" );
448
454
}
449
455
450
- return builder .build ();
456
+ CSVFormat csvFormat = builder .build ();
457
+ cached .set (csvFormat ); // Save in cache
458
+ return csvFormat ;
451
459
}
452
460
453
461
/**
You can’t perform that action at this time.
0 commit comments