[svn:parrot] r35672 - trunk/languages/pipp/src/pct

[email protected]
Newsgroups perl.cvs.parrot
Message-ID <[email protected]>
Author: bernhard
Date: Sat Jan 17 03:31:21 2009
New Revision: 35672

Modified:
   trunk/languages/pipp/src/pct/actions.pm

Log:
[Pipp] Load pipp.pbc, so that dumped PIR executes without complaints

Modified: trunk/languages/pipp/src/pct/actions.pm
==============================================================================
--- trunk/languages/pipp/src/pct/actions.pm	(original)
+++ trunk/languages/pipp/src/pct/actions.pm	Sat Jan 17 03:31:21 2009
@@ -28,18 +28,26 @@
             '$_FILES', '$_COOKIE', '$_SESSION', '$_REQUEST', '$_ENV' );
 
     if $key eq 'open' {
-        my $block := PAST::Block.new(
-                         :node($/),
-                         :hll('pipp')
-                     );
+        my $main := PAST::Block.new(:node($/), :hll('pipp'));
+
+        # Create the main startup block.
+        # This makes sure that needed libs are loaded
+        $main.loadinit().push(
+            PAST::Op.new( :inline('$P0 = compreg "Pipp"',
+                                  'unless null $P0 goto have_pipp',
+                                  'load_bytecode "pipp.pbc"',
+                                  'have_pipp:')
+            )
+        );
+
 
         # by default all symbols are lexical
-        $block.symbol_defaults( :scope('lexical') );
+        $main.symbol_defaults( :scope('lexical') );
 
         # set up scope 'package' for the superglobals
-        for ( @?SUPER_GLOBALS ) { $block.symbol( :scope('package'), $_ ); }
+        for ( @?SUPER_GLOBALS ) { $main.symbol( :scope('package'), $_ ); }
 
-        @?BLOCK.unshift($block);
+        @?BLOCK.unshift($main);
     }
     else {
         # retrieve the block created in the "if" section in this method.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.