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

[svn:parrot] r34680 - in trunk: examples/tutorial t/examples

From:
coke
Date:
December 30, 2008 16:32
Subject:
[svn:parrot] r34680 - in trunk: examples/tutorial t/examples
Message ID:
20081231003253.5F2F0CB9FA@x12.develooper.com
Author: coke
Date: Tue Dec 30 16:32:52 2008
New Revision: 34680

Modified:
   trunk/examples/tutorial/40_file_ops.pir
   trunk/t/examples/tutorial.t

Log:
Instead of cleaning up quietly after the tutorial, encourage new developers to DTRT.



Modified: trunk/examples/tutorial/40_file_ops.pir
==============================================================================
--- trunk/examples/tutorial/40_file_ops.pir	(original)
+++ trunk/examples/tutorial/40_file_ops.pir	Tue Dec 30 16:32:52 2008
@@ -7,15 +7,18 @@
 .sub main :main
     .local pmc fileout, filein
 
-    fileout = open "40_file_ops_data.txt", 'w'
+    fileout = open '40_file_ops_data.txt', 'w'
     print fileout, "The quick brown fox jumps over the lazy dog.\n"
     close fileout
 
-    filein = open "40_file_ops_data.txt", 'r'
+    filein = open '40_file_ops_data.txt', 'r'
     $S0 = readline filein
     say $S0
     close filein
 
+    # Be nice and remove the temporary file we created.
+    $P1 = new 'OS'
+    $P1.'rm'('40_file_ops_data.txt')
 .end
 
 # Local Variables:

Modified: trunk/t/examples/tutorial.t
==============================================================================
--- trunk/t/examples/tutorial.t	(original)
+++ trunk/t/examples/tutorial.t	Tue Dec 30 16:32:52 2008
@@ -249,15 +249,6 @@
     }
 }
 
-
-
-# cleanup
-{
-
-    # The example '40_file_ops.pir' leave a temporary file.
-    unlink '40_file_ops_data.txt';
-}
-
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4



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