Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deleting a disallowed key should croak too #5

Open
XSven opened this issue Sep 19, 2024 · 5 comments
Open

deleting a disallowed key should croak too #5

XSven opened this issue Sep 19, 2024 · 5 comments

Comments

@XSven
Copy link

XSven commented Sep 19, 2024

You have mentioned an alternative implementation way that could be based on Hash::Util::lock_keys(). But such kind of implementation would be different because your DELETE() override does not croak when applied to a disallowed key. From my perspective the DELETE() override should be changed so that the assertion

...
eval { delete $hash{four} };
ok($@ ne '');
...

passes.

@davorg
Copy link
Collaborator

davorg commented Sep 19, 2024

I wanted the same behaviour as a standard hash - where deleting a non-existent key fails silently.

@XSven
Copy link
Author

XSven commented Sep 19, 2024

The important difference is that the non-existent key is a disallowed key (not part of the fixed key list) . Such a key should trigger the same behaviour when calling STORE() and DELETE(). That is also what Hash::Util::lock_keys() enforces!

@davorg
Copy link
Collaborator

davorg commented Sep 19, 2024

To be honest with you, this module was written as a toy, demonstrating tying modules. I wrote it for a perl.com article over twenty years ago. I don't expect anyone to use it (especially not since lock_keys() has been available).

If you'd like to send me your CPAN ID, I'd be happy to hand the module over to you. I'll add you as a collaborator on the repo so you can do what you like with it.

@XSven
Copy link
Author

XSven commented Sep 20, 2024

Sorry I don't want to upset you. I know the perl.com article and that was the trigger to look into this module. One of the problems of CPAN is the growing number of toy modules. I think you have written an article about some other problem that CPAN suffers from. Unfortunately I cannot find it anymore. I try to take each module that I am looking at serious. So my CPAN id is SVW.

@davorg
Copy link
Collaborator

davorg commented Sep 20, 2024

Oh, I'm not upset at all. I just don't really have the time or interest to maintain this module any more. So it's all yours :-)

I've sent you invitations to become a collaborator on the repo. And I'll now give you comaint on CPAN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants