Re: Win32::TieRegistry or Perl problem (?)]

2005-03-07 Thread Austin Schutz
On Tue, Mar 08, 2005 at 10:40:30AM +1300, Sam Vilain wrote:
> Ken Williams wrote:
> >
> >On Mar 2, 2005, at 5:53 PM, Linda W wrote:
> >
> >>I'm not sure what perl does with invalid
> >>character data in a variable when you try to manipulate
> >>it by appending it to another value.
> >
> >
> >There's no such thing as invalid character data in Perl strings.  Perl 
> >strings can contain arbitrary binary data.
> 
> Sure, in the "C" locale.
> 
> Outside of that, all bets are off.  You could quite easily have arbitrary
> binary data in a Perl scalar that isn't valid character data in UTF-8,
> for instance.
> 
> Sam.

..but that has nothing to do with how perl operates on scalars.
Perl will gladly append anything to anything. Whether or not that pops out
correctly or not in your favorite encoding has no effect on the perl
behavior. That was the gist of the original question, as I read it.
If you are using some sort of encoding module you should check the
documentation for the module to see what it does with invalid data, as there
is no such thing natively.


Austin


Re: Win32::TieRegistry or Perl problem (?)]

2005-03-07 Thread Ken Williams
On Mar 7, 2005, at 3:40 PM, Sam Vilain wrote:
Ken Williams wrote:
On Mar 2, 2005, at 5:53 PM, Linda W wrote:
I'm not sure what perl does with invalid
character data in a variable when you try to manipulate
it by appending it to another value.
There's no such thing as invalid character data in Perl strings.  
Perl strings can contain arbitrary binary data.
Sure, in the "C" locale.
Outside of that, all bets are off.  You could quite easily have 
arbitrary
binary data in a Perl scalar that isn't valid character data in UTF-8,
for instance.
Oh, I see.  Right.
 -Ken


Re: Win32::TieRegistry or Perl problem (?)]

2005-03-07 Thread Sam Vilain
Ken Williams wrote:
On Mar 2, 2005, at 5:53 PM, Linda W wrote:
I'm not sure what perl does with invalid
character data in a variable when you try to manipulate
it by appending it to another value.

There's no such thing as invalid character data in Perl strings.  Perl 
strings can contain arbitrary binary data.
Sure, in the "C" locale.
Outside of that, all bets are off.  You could quite easily have arbitrary
binary data in a Perl scalar that isn't valid character data in UTF-8,
for instance.
Sam.


Re: Win32::TieRegistry or Perl problem (?)]

2005-03-03 Thread Ken Williams
On Mar 2, 2005, at 5:53 PM, Linda W wrote:
I'm not sure what perl does with invalid
character data in a variable when you try to manipulate
it by appending it to another value.
There's no such thing as invalid character data in Perl strings.  Perl 
strings can contain arbitrary binary data.

 -Ken


RE: Win32::TieRegistry or Perl problem (?)]

2005-03-03 Thread Orton, Yves
Title: RE: Win32::TieRegistry  or Perl problem (?)]





> -Original Message-
> From: Linda W [mailto:[EMAIL PROTECTED]] 
> Sent: 03 March 2005 00:54
> To: module-authors@perl.org
> Subject: Re: Win32::TieRegistry or Perl problem (?)]


You should ask this on Perlmonks.org, the author of Win32::TieRegistry hangs out there.


Yves





Re: Win32::TieRegistry or Perl problem (?)]

2005-03-02 Thread Linda W
A. Pagaltzis wrote:
* Linda W <[EMAIL PROTECTED]> [2005-03-02 01:20]:
As it is, TieRegistry certainly seems to have problems
reliably accessing values under keynames where the keynames
are not ascii strings. [...] something in the registry export
feature doesn't quite translate the keynames the same under
UCS-16 v. UTF-8.  :-(
Surely that's simply a bug and doesn't warrant wholesale
deprecation of TieRegistry? Sounds like someone isn't doing the
required work of making Perl understand the Unicode-ness of the
strings. The module you want to look into is not utf8 (which
doesn't do much), it's Encode, and in your particular case
probably Encode::Unicode.
If you are attempting to fix the module yourself and you don't
know much about encodings, be sure to read "The Absolute Minimum
Every Software Developer Absolutely, Positively Must Know About
Unicode and Character Sets (No Excuses!)"[1].
[1] http://www.joelonsoftware.com/articles/Unicode.html
It may be a bug, but I'm not certainly not the best person
to try to fix it.
Problem is that the keys have binary names that may or
may not be valid UTF/Unicode characters.  As near as I
can tell, there is no requirement on key or value _names_
other than that they cannot contain a "\". 

It would seem binary garbage is 'ok' for a keyname.  I
don't know how perl can "string-ify" such garbage -- especially
if you look at the above two text files in Gvim -- one of
the keynames doesn't even map to the same displayable
characters which indicates it might be an invalid unicode
character.  I'm not sure what perl does with invalid
character data in a variable when you try to manipulate
it by appending it to another value.
>>>It could be a bug in perl.<<<
I'm using the returned member names from indexing a key
as hash-keys into sub-keys or sub-values.  In this specific
case, they are sub-keynames that are binary.  To look up
such a key, one must append a backslash to it "\\".
Thus the code snippet:
print_key($cur_key->{"$keyname\\"}, "$keyname",$level+1);
Where it recursively calls the print_key routine to lookup
subkeys/values.  It does have 1 value under the keyname
(the default value).  I can manipulate the key using regedit,
but not, seemingly, in perl via TieRegistry.  I'm not sure
if the fault is in TieRegistry or perl.
If you are on a Win platform, you should be able to change
one of the above txt files to extension, .reg, and import
it, but I can't guarantee that they will both import the same.
That'd be a separate experiment...:-) (*sigh*)
Xposting to porter's list as it may require some insight
into how perl handles such odd cases and may be a perl 5.8.6
bug.  If anyone on the perl5-porters list wants to see the code
snippet, I can post that as well, it's fairly simplistic/small
(~1K).  I was using it as a "test" program to see if I could
iterate my registry with TieRegistry under perl and if perl
could be used, reliably, to manipulate the registry.
It enumerated my "Classes" key, but quickly failed on the
"CUser" key because of these weird keynames.
Linda


REGEDIT4

[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\.Default\Curren0]
@="Audio\\VoyTheme\\STBeep1.wav"

[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\.Default\current0?]
@="Audio\\VoyTheme\\STBeep1.wav"

[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\.Default\current0?]
@="Audio\\VoyTheme\\STBeep1.wav"

[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\AppGPFault\Curren0]
@="Audio\\Computer\\Computer error.wav"

[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\AppGPFault\current0?]
@="Audio\\Computer\\Computer error.wav"

ÿþWindows Registry Editor Version 5.00



[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\.Default\Curren0]

[EMAIL PROTECTED]"Audio\\VoyTheme\\STBeep1.wav"



[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\.Default\current0?]

[EMAIL PROTECTED]"Audio\\VoyTheme\\STBeep1.wav"



[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\.Default\current0¼€]

[EMAIL PROTECTED]"Audio\\VoyTheme\\STBeep1.wav"



[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\AppGPFault\Curren0]

[EMAIL PROTECTED]"Audio\\Computer\\Computer 
error.wav"



[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\AppGPFault\current0¼€]

[EMAIL PROTECTED]"Audio\\Computer\\Computer 
error.wav"