develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r33771 - trunk/languages/lua/src/lib

From:
fperrad
Date:
December 10, 2008 09:08
Subject:
[svn:parrot] r33771 - trunk/languages/lua/src/lib
Message ID:
20081210164636.8BEFECBA89@x12.develooper.com
Author: fperrad
Date: Wed Dec 10 08:46:35 2008
New Revision: 33771

Modified:
   trunk/languages/lua/src/lib/luaaux.pir

Log:
[Lua] pdd22io
- more FileHandle
- refactor exception handling

Modified: trunk/languages/lua/src/lib/luaaux.pir
==============================================================================
--- trunk/languages/lua/src/lib/luaaux.pir	(original)
+++ trunk/languages/lua/src/lib/luaaux.pir	Wed Dec 10 08:46:35 2008
@@ -651,21 +651,22 @@
     goto L2
   L1:
     chunkname = filename
-    f = open filename, '<'
-    unless f goto L3
+    f = new 'FileHandle'
+    push_eh _handler
+    f.'open'(filename, 'r')
+    pop_eh
   L2:
     $S0 = f.'readall'()
     if filename == '' goto L4
-    close f
+    f.'close'()
   L4:
     .tailcall lua_load($S0, chunkname)
-  L3:
+  _handler:
     $S0 = 'cannot open '
     $S0 .= filename
     $S0 .= ': '
     $S1 = err
     $S0 .= $S1
-  L5:
     null $P0
     .return ($P0, $S0)
 .end



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About