开发者

Is there some lightweight user preference support in CPAN?

I want to have my Perl program support both Win32 开发者_C百科Registry and the similar feature in Linux.

GConf maybe a good idea, but it's too heavy. Is there some lightweight user preference support in CPAN?


Why not use YAML (and YAML::XS)?

Now the main thing that suggests YAML to me is that it supports nested structures. Thus, you could still keep the concept of Key.subkey.subkey.... from the Windows registry and thus keep the concept structure similar.

You would need to create an object that reads the YAML file and then handles requests and storage via paths. In the YAML, you could even create HKEY_CURRENT_USER sections or something.

---
HKEY_LOCAL_MACHINE:
  Software:
    Brand A:
      Product P:
        Items: 
          - One
          - Two
          - Three

And you would read this by turning '/HKEY_LOCAL_MACHINE/Software/Brand A/Product P/Items' into

$yaml_reg->{HKEY_LOCAL_MACHINE}{Software}{'Brand A'}{'Product P'}{Items}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜