Generated: Tue Feb 2 17:54:58 2010 from test6.pl 2006/09/18 1.8 KB.
#!C:/Perl -w #AIM: Test 'package' function # In general some things work, but LOTS DO NOT ;=(( # Trying to load @stxBI using an external function # seemed to FAIL, even with push(@main::@stxBI, $txt) # The only way was to put add_2_array in main, # and call from the other module using main::add_2_array($$) ... # Maybe I was doing something wrong??? # use strict; use warnings; package main; require "logfile.pl" or die "ERROR: Can not load logfile.pl ...\n"; my $old_ind = 'temp2/index.htm'; my $php_stx = 'C:/Program Files/EditPlus 2/php.stx'; ################### my %HOldbifs = (); my @AFileNames = (); my @stxBI = (); my @stxRW = (); my @stxVA = (); ################### sub add_2_array($$) { my ($kw, $tx) = @_; ###prt("Adding [$kw] [$tx] ...\n"); if ($kw == 1) { ##push((@main::stxRW), $tx); push((@stxRW), $tx); } elsif ($kw == 2) { ##push((@main::stxBI), $tx); push((@stxBI), $tx); } elsif ($kw == 3) { ##push((@main::stxVA), $tx); push((@stxVA), $tx); } } # search the @BuiltIns array for an entry sub is_built_in { my ($tb) = shift; foreach my $srw (@stxBI) { if ($tb eq $srw) { return 1; } } return 0; } sub add_2_old($$) { my ($k,$v) = @_; ###oi_prt( "Adding key [$k]: [$v]...\n" ); if (exists $HOldbifs{$k}) { prt("\nWARNING: [$k] appears DUPLICATED ...\n had=[".$HOldbifs{$k}."\nadding [$v]\n\n"); $HOldbifs{$k} .= $v; } else { $HOldbifs{$k} = $v; } } require "oldindex.pl" or die "ERROR: Unable to load oldindex.pl ...\n"; oldindex::load_php_stx( $php_stx ); prt( "Loaded ".scalar @stxRW." RW, ".scalar @stxBI." BI, and ".scalar @stxVA." vars\n" ); oldindex::get_old_index($old_ind); my $cnt = scalar keys %HOldbifs; print "Found 2 $cnt built-in ...\n"; # eof - test6.pl