it seems that taking out $Registry form my my declarations and moving as 
much as i can to localized my declarations eliminates the initialization 
issue (so $Register MUST be like %RegHash and in Win32::TieRegistry... ok. 
lesson learned... even though prior to this last run that did not help, 
but rather made things worse...obviuosly something else was compounding 
it)

however, now i cannot seem to get the data value set, so i end up with 
different initialization errors. moving $regval to a global does not 
change a thing. 

any enlightenment would be greatly appreciated.


DOS command shell print out:

C:\Documents and Settings\jperlmutter.GRANITE_ENG\My 
Documents\perl\test_scripts\SeaNotify>perl tsnt.pl -l trials.txt -iter 1 
-verb
 -verb
Sea Notify test started at Wed Aug 17 16:53:13 2005
Using Windows version of SeaNotify....registry interaction started
Setting Delimiter
Setting registry path short to 
HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/
Use of uninitialized value in concatenation (.) or string at tsnt.pl line 
129.
Found in registry:
Use of uninitialized value in pattern match (m//) at tsnt.pl line 131.
Use of uninitialized value in concatenation (.) or string at tsnt.pl line 
147.
Found in registry:
Use of uninitialized value in pattern match (m//) at tsnt.pl line 149.
Use of uninitialized value in -f at tsnt.pl line 161.
Use of uninitialized value in -f at tsnt.pl line 161.

C:\Documents and Settings\jperlmutter.GRANITE_ENG\My 
Documents\perl\test_scripts\SeaNotify>perl tsnt.pl -l trials.txt -iter 1 
-verb
 -verb
Sea Notify test started at Wed Aug 17 16:54:57 2005
Using Windows version of SeaNotify....registry interaction started
Setting Delimiter
Setting registry path short to 
HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/
Use of uninitialized value in concatenation (.) or string at tsnt.pl line 
129.
Found in registry:
Use of uninitialized value in pattern match (m//) at tsnt.pl line 131.
Use of uninitialized value in concatenation (.) or string at tsnt.pl line 
147.
Found in registry:
Use of uninitialized value in pattern match (m//) at tsnt.pl line 149.
Use of uninitialized value in -f at tsnt.pl line 161.
Use of uninitialized value in -f at tsnt.pl line 161.

C:\Documents and Settings\jperlmutter.GRANITE_ENG\My 
Documents\perl\test_scripts\SeaNotify>




---------------------------------------------------------------------------------
program (with line numbers 129,131,147,149,161 added)
---------------------------------------------------------------------------------
#! /usr/bin/perl -w
use strict;
use Getopt::Long; # used in getting unix-style options
use Win32::TieRegistry;
use POSIX;
use File::Copy "mv";
use warnings;

################################################################
# Purpose:
#    This script does infinite loop for a test
#    This is for use as a tester for SeaNotify
#
# This should be kept as both a script and an executable. The executable 
should be made by the last person to revise the script. The Active State 
Perl PDK has been used.
#
# this was made when a plaintext file method was asked for
#
# Created: 08/15/2005
# Original Author: Josh Perlmutter
# Maintainers:
# Last Revised: 08/17/2005
# Copyright SeaChange International (tm)
################################################################

my(@watch, @vals);
my($posix, $iter, $done, $val, $log);
my($help, $verb, $qrev, $rev, $revdat, $modules); # standard 
options/revision information variables
$posix=0; $iter=0; $done=0; $log='';
$modules="\tnothing as of now\n\n"; $help=0; $qrev=0;
$rev="0.1"; $revdat="08/17/2005"; $verb=0;
# short explanation of variables:


###########################
# this section deals with options. it looks for posix-style options 
passed. that is, <script> -option [value]
# now get the options 
GetOptions ('help' => \$help, 'verbose+' => \$verb, 'version+' => \$qrev, 
'posix' => \$posix, 'iterations:i' =>\$iter, 'log:s'=>\$log);

######
# arguments ARE required
# if help or version is not on OR the required input paramaters
unless($help || $qrev ||
       ((0 < $iter) && ($log ne ''))){
  print "\nYou must supply at least 2 parameter(s) to run this program. It 
needs: iterations (must be positive, non-zero number) and file to log 
to\n";
  print "Turning on help.\n";
  $help++;
}

#
# now put the options to use...
#
if($help){ # show options and use since asked for
  print "\tFile: $0\tVersion: $rev\tReleased: $revdat\n";
  print "\nThis is the $0 file.\n";
  print "\nThe options for this file are:\n";
  print "\t-help\t\tThis help screen only (overrides all other 
options)\n";
  print "\t-version\tList Version and exit (overrides everything but 
-help)\n";
  print "\t-verbose\tTurn on verbose (useful for debugging errors; call 
twice\n\t\t\t for extra output)\n";
#  print "\t-\t\t\n";
  print "\t-log\t\tfile to log activity to\n";
  print "\t-iterations\thow many times shall it modify files?\n";
#  print "\t-posix\t\tflag it for posix system\n";
  print "\n\tusage ([] denotes optional argument {} denotes default value 
{} denotes\n\t\t option set of which your choice of one is required):\n";
  print "$0 [-help] [-version] [-verbose] -log <log> -iterations 
<iterations> \n\n";
  print "to debug try: $0 -verb -verb > debug_log.txt\n\n";

  exit;
  # leave the script since we were just showing use
}

die "\tFile: $0\tVersion: $rev\tReleased: $revdat\n" if $qrev; # query for 
versions being used

# The following options are done (mostly) as true/false. Placing the 
option on the command line results in
# Perl's Getopt::Long adding 1 to the value of the variable for each time 
it appears on the command line. This
# is how the multi-level verbose is initiated. The rest are used soley as 
true/false.
#
# verbose ($verb) turned on if -verb(ose) or --verbose was place in the 
command line.
 # verbose put to extra output (useful in debugging pattern issues) if 
called twice.
#
#  ($) turned on if -() or -- was placed in the command line
#

#####################################################
## previous testers test on directory modification. #
## this feature is seemingly failing miserably.     #
## this version tests on files that are in there.   #
## it randomly and destructively causes changes to  #
## files once every 15 minutes for $iter iterations #
#####################################################

open LOG, ">$log" or die "Cannot create $log: $!\n";
&rep("Sea Notify test started at ".localtime, $verb);

############
# this section finds the registry key value for what is watched.
# first it queries the registery for them, then it imports them
# into an array. while it does this it drops the c:\windows\ (on
# windows) and the /boot, /root and /etc (on *nix) dirs for boot
# protection. it uses the posix flag to tell register versus
# configuration file
unless ($posix){
  # we're doing the windows version, we need the Win32::TieRegistry
  # module via this module we get two items from the registry and
  # then check them for files that we can modify that are not in a
  # place that makes them sensitive to booting right (services)
  # then place the values that are files into an array (@watch)
  # which will be used later to test SeaNotify

  # local variables (only used in this section)
  my(@watch, $regval, $regpth, $key);

  # declaration of TieReg @ begining: use Win32::TieRegistry;
  &rep("Using Windows version of SeaNotify....registry interaction 
started", $verb);

  &rep("Setting Delimiter", $verb);
  $key = $Registry -> Delimiter('/');

  &rep("Setting registry path short to 
HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/",$verb);
  $regpth="HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services";

  # this line useful if needing to debug with an interactive debugger
  # (it will take a long while when you check the value of the array)
#  @members = $Registry->{"$regpth/SeaNotify"}->MemberNames;

  # retrieve the registry value(s)
  $regval = $Registry ->  {"$regpth/SeaNotify/"} -> 
GetValue("/SeaNotifyFiles");

  # debug call
  if($verb>1){ &rep("Found in registry: $regval",$verb); }# line 129

  while($regval =~ m/(\w:)(.+?)(\w:.*)/){ # line 131
    # convert to one value per line in 2 steps
    # 1: put the path together
    # 2: remove first piece
    $val=$1.$2;
    push @vals, $val;
    $regval=$3;
  }
  # get final piece
  push @vals, $regval;

  # also get SeaNotifyAdditionalDirs
  # retrieve the registry value(s)
  $regval = $Registry ->  {"$regpth/SeaNotify/"} -> 
GetValue("/SeaNotifyAdditionalDirs");

  # debug call
  if($verb>1){ &rep("Found in registry: $regval",$verb); } # line 147

  while($regval =~ m/(\w:)(.+?)(\w:.*)/){  # line 149
    # convert to one value per line in 2 steps
    # 1: put the path together
    # 2: remove first piece
    $val=$1.$2;
    push @vals, $val;
    $regval=$3;
  }
  # get final piece
  push @vals, $regval;

  foreach $val (@vals){
    if(-f $val){ $ line 161
      push @watch,$val;
      if($verb>1){ &rep("Found file $val",$verb); }
    }
  }

# now we have the windows @watch done
####
# now to do the posix version
}else{
# posix stuff depends on where config is placed and how it is set
# up. as of yet there is no posix version and no plans for one,
# which makes this far too ambiguous to do more than give this
# skeleton for posix.
}
############
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to