[EMAIL PROTECTED] wrote:
> Incase people are interested....
> 
> chomp wasn't working since it removes new-lines (was my first
> thought) chop worked but i couldn't verify i wasn't taking off too
> much 
> 
> someone here has a byte dumping program in hex. he asked that
> i log the ending character.  after doing so he ran it through
> the program it turns out the registry separates values using the NULL
> character. 
> 
> the problem I found with this is that it ONLY works in a m//
> or s/// context when it is the LONE item in the part to be
> matched (that or the s/// context will work if i spend more time with
> it) 
> 
> the solution I found was to change the chunk of code sent last time
> to: 
> 
>   # retrieve the registry value(s) of the files to watch
>   # also get SeaNotifyAdditionalDirs
>   $regval = $Registry ->  {"$regpth/SeaNotify/"} ->
>   GetValue("SeaNotifyFiles"); $regval .= $Registry -> 
>         {"$regpth/SeaNotify/"} -> GetValue("SeaNotifyAdditionalDirs");
> 
>   # debug call
>  if($verb>1){ &rep("Found in registry: $regval",$verb); }
> 
>   while($regval =~ m/(\w:)(.+?)(\w:.*)/){
>     # convert to one value per line in 2 steps
>     # 1: put the path together
>     # 2: remove first piece
>     my $val=$1.$2;
> 
>     # remove the null(s) on the end
>     while(my $q = chop($val)){
>       unless($q =~ m/\0/){
>         $val.=$q;
>         last;
>       }
>     }
> 
>     # add ONLY files and directories (sym links et al will be ignored
> for now)
>     if(-f $val){ push @watch, $val; }
> # || (-d $val)){ push @watch, $val; }
>     $regval=$3;
>   }
>   # get the final value
>   if(-f $regval){
>     # || (-d $regval)){
> 
>     # remove the null(s) on the end
>     while(my $q = chop($regval)){
>       unless($q =~ m/\0/){
>         $regval.=$q;
>         last;
>       }
>     }
> 
>     push @watch, $regval; }
> 
>   if($verb>1){
>     foreach my $val (@watch){
>       if(-f $val){
>         &rep("Found file $val|<-",$verb); }
>       elsif(-d $val){ &rep("Found directory $val|<-",$verb); }
>       else{ &rep("How did this get in here? val is: $val|<-", $verb);
>     } }
>   }
> 
> 
> 
> 
> i dont know how many will find this usable news, but i figure
> it cannot hurt to inform the list the solution that I found

$val =~ s/\0+//;

should do the trick.

However if you want to avoid seeing the nulls in the first place, the
documentation for GetValues (in 'perldoc Win32::TieRegistry') tells you
how. As I think my previous post does, perhaps you haven't seen it yet.

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

Reply via email to