@@ -173,10 +173,7 @@ public boolean getDefinedBoolean() {
173173 * @return A RuntimeScalar representing the typeglob.
174174 */
175175 public RuntimeScalar scalar () {
176- RuntimeScalar ret = new RuntimeScalar ();
177- ret .type = RuntimeScalarType .GLOB ;
178- ret .value = this ;
179- return ret ;
176+ return new RuntimeScalar (this );
180177 }
181178
182179 /**
@@ -321,25 +318,26 @@ public RuntimeGlob undefine() {
321318 }
322319
323320 /**
324- * Saves the current state of the instance.
325- *
326- * <p>This method creates a snapshot of the current value,
327- * and pushes it onto a static stack for later restoration. After saving, it clears
328- * the current elements and resets the value.
321+ * Saves the current state of the typeglob.
329322 */
330323 @ Override
331324 public void dynamicSaveState () {
332- throw new PerlCompilerException ("not implemented: local GLOB" );
325+ GlobalVariable .getGlobalCodeRef (this .globName ).dynamicSaveState ();
326+ GlobalVariable .getGlobalArray (this .globName ).dynamicSaveState ();
327+ GlobalVariable .getGlobalHash (this .globName ).dynamicSaveState ();
328+ GlobalVariable .getGlobalVariable (this .globName ).dynamicSaveState ();
329+ GlobalVariable .getGlobalIO (this .globName ).dynamicSaveState ();
333330 }
334331
335332 /**
336- * Restores the most recently saved state of the instance.
337- *
338- * <p>This method pops the most recent state from the static stack and restores
339- * the value. If no state is saved, it does nothing.
333+ * Restores the most recently saved state of the typeglob.
340334 */
341335 @ Override
342336 public void dynamicRestoreState () {
343- throw new PerlCompilerException ("not implemented: local GLOB" );
337+ GlobalVariable .getGlobalIO (this .globName ).dynamicRestoreState ();
338+ GlobalVariable .getGlobalVariable (this .globName ).dynamicRestoreState ();
339+ GlobalVariable .getGlobalHash (this .globName ).dynamicRestoreState ();
340+ GlobalVariable .getGlobalArray (this .globName ).dynamicRestoreState ();
341+ GlobalVariable .getGlobalCodeRef (this .globName ).dynamicRestoreState ();
344342 }
345343}
0 commit comments