[EMAIL PROTECTED] wrote:
> ok, so as it turns out the one I have that seems to interact
> has some sort of issue in doing the tests that is somewhere
> between hard and impossible to determine without
> understanding win32::tieregistry better. in order to learn it
> to understand it better, i decided to get the first one using
> strict as some of the programmers here request in order to
> have good code.
>
> here's is the current and previous issue I have
>
> C:\Documents and Settings\jperlmutter.GRANITE_ENG\My
> Documents\perl\test_scripts\SeaNotify>perl -w tsnt.pl -log
> trials.txt -iter 1 Global symbol "$Registry" requires
> explicit package name at tsnt.pl line 119.
> Global symbol "$Registry" requires explicit package name at
> tsnt.pl line 124.
> Global symbol "$Registry" requires explicit package name at
> tsnt.pl line 126.
> Execution of tsnt.pl aborted due to compilation errors.
>
> C:\Documents and Settings\jperlmutter.GRANITE_ENG\My
> Documents\perl\test_scripts\SeaNotify>perl -w tsnt.pl -log
> trials.txt -iter 1 Can't call method "Delimiter" on an
> undefined value at tsnt.pl line 119.
>
> and here's the relevant code through line 130. the ... is
> stuff i took out dealing with handling passed options
>
>
> #! /usr/bin/perl -w
> use strict;
> use Getopt::Long; # used in getting unix-style options
> use Win32::TieRegistry (TiedHash => '%RegHash');
> use POSIX;
> use File::Copy "mv";
>
> my(@watch, @vals, @members);
> my($posix, $file, $key, $val, $iter, $done, $log, $regpth, $Registry);
> 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;
>
> 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\ # dirs
> for boot protection. # 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
>
> # declaration of TieReg @ begining: use Win32::TieRegistry
> (TiedHash => '%RegHash');
> &rep("Using Windows version of SeaNotify....registry interaction
> started", $verb);
>
> &rep("Setting Delimiter", $verb);
> $Registry -> Delimiter('/');
>
> &rep("Setting registry path short to
> HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/",$verb);
> $regpth="HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services";
>
> @members = $Registry->{"$regpth/SeaNotify"}->MemberNames;
>
> @vals = $Registry -> {"$regpth/SeaNotify/"} ->
> GetValue("/SeaNotifyFiles");
>
> foreach $val (@vals){
> if(-f $val){ push @watch,$val; }
> }
>
>
> I thought that $Registry was defined in Win32::TieRegistry,
> but I guess
> it's something you inherit once you declare. I don't get the undefined
> value error. can someone please explain the failure to me? is this
> because of something in the module or in my code?
>From the documentation:
"The code
use Win32::TieRegistry;
imports the variable $Registry into your package and sets it to be a
reference to a hash tied to a copy of the master Registry virtual root
object with the default options. ...
Alternately, you can specify a list of arguments on the use line ..."
So you can't use both. You have to pick one.
HTH
--
Brian Raven
-----------------------------------------------------------------------
The information contained in this e-mail is confidential and solely
for the intended addressee(s). Unauthorised reproduction, disclosure,
modification, and/or distribution of this email may be unlawful. If you
have received this email in error, please notify the sender immediately
and delete it from your system. The views expressed in this message
do not necessarily reflect those of LIFFE Holdings Plc or any of its subsidiary
companies.
-----------------------------------------------------------------------
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs