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

deprecate read/write object attributes #152

Open
sherrardb opened this issue Jan 22, 2020 · 0 comments
Open

deprecate read/write object attributes #152

sherrardb opened this issue Jan 22, 2020 · 0 comments

Comments

@sherrardb
Copy link
Collaborator

long-term plan note:

there is a mix of objects whose attributes are all 'ro' and those with some subset of attributes that are 'rw'. i think that the argument for deprecation has merit solely on the basis of interface consistency. but my bigger concern is the likelihood of user confusion when allowing updates to the attributes of a retrieved object.

a simple example is

my $customer = $stripe->get_customer( customer_id=> $customer_id);
$customer->email( $new_email_address );
...
# code that makes use of $customer->email()

where the user has not re-posted the customer object.

and the fact that this doesn't behave as expected is just as bad:

~$ perl -Mstrict -Mwarnings -mNet::Stripe -e 'my $stripe = Net::Stripe->new(api_key => $ENV{STRIPE_API_KEY});
my $customer = $stripe->post_customer(
  email=> "john.doe\@example.com"
);
print $customer->email()."\n";
$stripe->post_customer(
  customer=> $customer,
  email=> "dr.john.doe\@example.com"
);
print $customer->email()."\n";'
[email protected]
[email protected]

it is also worth noting that we are significantly lacking in unit tests that verify the expected behavior when updating object attributes and re-posting.

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

No branches or pull requests

1 participant