develooper Front page | perl.perl5.porters | Postings from November 2017

[perl #132488] Storable: add a flag to control 'bless' and 'tie'

Thread Next
From:
Nicolas R .
Date:
November 22, 2017 20:28
Subject:
[perl #132488] Storable: add a flag to control 'bless' and 'tie'
Message ID:
rt-4.0.24-27237-1511382477-559.132488-75-0@perl.org
# New Ticket Created by  Nicolas R. 
# Please include the string:  [perl #132488]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=132488 >


I would like to open a discussion and get feedback on a Storable patch that I am considering to submit to blead.
The idea is to introduce a flag in order to let a user disable or not: "bless" and "tie" features from Storable.

You can read the patch online here: https://github.com/p5h/perl5demo/pull/33

As the patch stands the original behavior is preserved. "bless" and "tie" are enabled when storing/retrieving objects.
We could consider to change (or not) this default value in the future.
For this reason, the patch introduces a constant 'Storable::FLAGS_COMPAT' to guarantee over time a consistent behavior.
	$Storable::flags = Storable::FLAGS_COMPAT;

Then a customer can disable both "bless" and "tie" by setting the flag to 0, in their script (no guarantee that any other dependency
would set it to a different value, but this is something else).
	$Storable::flags = 0; # to disable bless and tie support when 

Or users can simply disable one or the other
	$Storable::flags = Storable::BLESS_OK;
	$Storable::flags = Storable::TIE_OK;

Any concerns about such a patch?
Are you ok with setting the default value to "Storable::BLESS_OK | Storable::TIE_OK" (which is also Storable::FLAGS_COMPAT)?
Would you consider changing the default value in the future?

thanks
nicolas
Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About